Issue #3112 has been reported by mmcc. ---------------------------------------- Submit #3112: Avoid undefined shifts in bit selector loop http://bugs.dragonflybsd.org/issues/3112
* Author: mmcc * Status: New * Priority: Normal * Assignee: * Category: * Target version: ---------------------------------------- Hi guys. I fixed this issue in OpenBSD a while back, but I figured I should check and inform the rest of the BSDs. Shifting into or out of an int's sign bit is undefined, and this loop deterministically and intentionally does both. The following change was applied to OpenBSD and (IIRC) NetBSD. Thanks for your time, Michael McConville diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 8145d9e052..5930a462f2 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -108,7 +108,7 @@ int findproto(char *cp, int n) { struct sockaddr *sa; - int i; + unsigned int i; if (n == 0) return -1; -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account