diff options
author | glebius <glebius@FreeBSD.org> | 2016-12-07 23:34:06 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2016-12-07 23:34:06 +0000 |
commit | 897834470fcc320aaf75dc150ec701ce17c3491a (patch) | |
tree | 5839dfc2b4bb1d7ff5af7ee5d21dff4cf5899d87 /lib/libc/net | |
parent | bf1aadd32323ef06d5262356a7c5db2ce6dfa1d6 (diff) | |
download | FreeBSD-src-897834470fcc320aaf75dc150ec701ce17c3491a.zip FreeBSD-src-897834470fcc320aaf75dc150ec701ce17c3491a.tar.gz |
Merge r309688: address regressions in SA-16:37.libc.
PR: 215105
Submitted by: <jtd2004a sbcglobal.net>
Approved by: so
Diffstat (limited to 'lib/libc/net')
-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 f14f22d..fec220a 100644 --- a/lib/libc/net/linkaddr.c +++ b/lib/libc/net/linkaddr.c @@ -128,7 +128,7 @@ link_ntoa(sdl) static char obuf[64]; _Static_assert(sizeof(obuf) >= IFNAMSIZ + 20, "obuf is too small"); char *out; - const char *in, *inlim; + const u_char *in, *inlim; int namelen, i, rem; namelen = (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ; @@ -145,11 +145,11 @@ link_ntoa(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--; } @@ -157,15 +157,14 @@ link_ntoa(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) break; *out++ = hexlist[i]; - rem++; + rem--; } } *out = 0; |