git: 7755e8ae322b - stable/13 - ifconfig: fix UBSan signed shift error

Alex Richardson arichardson at FreeBSD.org
Sat Apr 10 13:30:13 UTC 2021


The branch stable/13 has been updated by arichardson:

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

commit 7755e8ae322b63875d7f7f426e61ce0bcb9e0086
Author:     Alex Richardson <arichardson at FreeBSD.org>
AuthorDate: 2021-01-19 11:35:21 +0000
Commit:     Alex Richardson <arichardson at 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;


More information about the dev-commits-src-branches mailing list