Avoid undefined shifts in bit selector loop
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,
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 8145d9e052..5930a462f2 100644
@@ -108,7 +108,7 @@ int
findproto(char *cp, int n)
struct sockaddr *sa;
- int i;
+ unsigned int i;
if (n == 0)