diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2016-12-08 03:20:51 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2016-12-08 03:20:51 +0000 |
commit | e9da434b35b011c74ad0cc88fd28dd8f39a697e3 (patch) | |
tree | 73d9241db9e808dea08d6c46d01361b5e512bdc2 | |
parent | 6276546bdf0d6e4311905e1f378504302ae920c3 (diff) |
Fix regressions introduce in the fix for CVE-2016-6559.
From FreeBSD (glebius)
-rw-r--r-- | lib/libc/net/linkaddr.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/libc/net/linkaddr.c b/lib/libc/net/linkaddr.c index 354067b3b59..9101e23a862 100644 --- a/lib/libc/net/linkaddr.c +++ b/lib/libc/net/linkaddr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linkaddr.c,v 1.8 2016/12/07 01:05:47 millert Exp $ */ +/* $OpenBSD: linkaddr.c,v 1.9 2016/12/08 03:20:50 millert Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -41,7 +41,7 @@ link_ntoa(const struct sockaddr_dl *sdl) { static char obuf[64]; char *out; - const char *in, *inlim; + const u_char *in, *inlim; int namelen, i, rem; namelen = (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ; @@ -58,11 +58,11 @@ link_ntoa(const struct sockaddr_dl *sdl) } } - in = (const char *)sdl->sdl_data + sdl->sdl_nlen; + in = (const u_char *)sdl->sdl_data + sdl->sdl_nlen; inlim = in + sdl->sdl_alen; while (in < inlim && rem > 1) { - if (in != (const char *)sdl->sdl_data + sdl->sdl_nlen) { + if (in != (const u_char *)sdl->sdl_data + sdl->sdl_nlen) { *out++ = '.'; rem--; } @@ -70,9 +70,8 @@ link_ntoa(const struct sockaddr_dl *sdl) if (i > 0xf) { if (rem < 3) break; + *out++ = hexlist[i >> 4]; *out++ = hexlist[i & 0xf]; - i >>= 4; - *out++ = hexlist[i]; rem -= 2; } else { if (rem < 2) |