Module Name:    src
Committed By:   maya
Date:           Tue May  9 02:56:44 UTC 2017

Modified Files:
        src/lib/libc/inet: inet_net_ntop.c

Log Message:
Avoid shift of negative signed integer. this is UB. NFC.

from gcc8, ok riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/inet/inet_net_ntop.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/inet/inet_net_ntop.c
diff -u src/lib/libc/inet/inet_net_ntop.c:1.3 src/lib/libc/inet/inet_net_ntop.c:1.4
--- src/lib/libc/inet/inet_net_ntop.c:1.3	Tue Mar 20 17:08:13 2012
+++ src/lib/libc/inet/inet_net_ntop.c	Tue May  9 02:56:44 2017
@@ -20,7 +20,7 @@
 #ifdef notdef
 static const char rcsid[] = "Id: inet_net_ntop.c,v 1.1.2.1 2002/08/02 02:17:21 marka Exp ";
 #else
-__RCSID("$NetBSD: inet_net_ntop.c,v 1.3 2012/03/20 17:08:13 matt Exp $");
+__RCSID("$NetBSD: inet_net_ntop.c,v 1.4 2017/05/09 02:56:44 maya Exp $");
 #endif
 #endif
 
@@ -199,7 +199,7 @@ inet_net_ntop_ipv6(const u_char *src, in
 		memset(inbuf + p, 0, 16 - p);
 		b = bits % 8;
 		if (b != 0) {
-			m = ~0 << (8 - b);
+			m = ~0u << (8 - b);
 			inbuf[p-1] &= m;
 		}
 

Reply via email to