Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Apr 2021 13:30:12 GMT
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 7755e8ae322b - stable/13 - ifconfig: fix UBSan signed shift error
Message-ID:  <202104101330.13ADUCHv006073@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=7755e8ae322b63875d7f7f426e61ce0bcb9e0086

commit 7755e8ae322b63875d7f7f426e61ce0bcb9e0086
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2021-01-19 11:35:21 +0000
Commit:     Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2021-04-10 13:01:56 +0000

    ifconfig: fix UBSan signed shift error
    
    Use 1u since UBSan complains about 1 << 31.
    
    (cherry picked from commit 94ac312a71683a3a1a928c6adfe927d6bb45044f)
---
 sbin/ifconfig/ifconfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 8b1a242db634..5e114b43c126 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1515,7 +1515,7 @@ printb(const char *s, unsigned v, const char *bits)
 		bits++;
 		putchar('<');
 		while ((i = *bits++) != '\0') {
-			if (v & (1 << (i-1))) {
+			if (v & (1u << (i-1))) {
 				if (any)
 					putchar(',');
 				any = 1;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104101330.13ADUCHv006073>