git: 94ac312a7168 - main - ifconfig: fix UBSan signed shift error

Alex Richardson arichardson at FreeBSD.org
Mon Jan 25 15:11:21 UTC 2021


The branch main has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=94ac312a71683a3a1a928c6adfe927d6bb45044f

commit 94ac312a71683a3a1a928c6adfe927d6bb45044f
Author:     Alex Richardson <arichardson at FreeBSD.org>
AuthorDate: 2021-01-19 11:35:21 +0000
Commit:     Alex Richardson <arichardson at FreeBSD.org>
CommitDate: 2021-01-25 15:09:50 +0000

    ifconfig: fix UBSan signed shift error
    
    Use 1u since UBSan complains about 1 << 31.
---
 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 e6e7908e18cd..90a84f2996bc 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1514,7 +1514,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-all mailing list