Date: Sat, 18 Sep 2021 17:40:01 GMT From: Marko Zec <zec@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: d3b9b83623f2 - stable/13 - [fib algo][dxr] Fix undefined behavior. Message-ID: <202109181740.18IHe1XK053217@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=d3b9b83623f2b7ab89d9c09b3e93360e0b72402b commit d3b9b83623f2b7ab89d9c09b3e93360e0b72402b Author: Marko Zec <zec@FreeBSD.org> AuthorDate: 2021-09-15 20:23:17 +0000 Commit: Marko Zec <zec@FreeBSD.org> CommitDate: 2021-09-18 17:36:32 +0000 [fib algo][dxr] Fix undefined behavior. The result of shifting uint32_t by 32 (or more) is undefined: fix it. (cherry picked from commit 442c8a245ee3c6640fc9321e18e8316edf469805) --- sys/netinet/in_fib_dxr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c index ec32819a5a6d..7afe2a3da024 100644 --- a/sys/netinet/in_fib_dxr.c +++ b/sys/netinet/in_fib_dxr.c @@ -1150,7 +1150,10 @@ dxr_change_rib_batch(struct rib_head *rnh, struct fib_change_queue *q, #endif plen = q->entries[ui].plen; ip = ntohl(q->entries[ui].addr4.s_addr); - hmask = 0xffffffffU >> plen; + if (plen < 32) + hmask = 0xffffffffU >> plen; + else + hmask = 0; start = (ip & ~hmask) >> DXR_RANGE_SHIFT; end = (ip | hmask) >> DXR_RANGE_SHIFT;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109181740.18IHe1XK053217>