Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Dec 2016 23:18:00 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r309688 - head/lib/libc/net
Message-ID:  <201612072318.uB7NI0mf021358@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Wed Dec  7 23:18:00 2016
New Revision: 309688
URL: https://svnweb.freebsd.org/changeset/base/309688

Log:
  Address regressions in SA-16:37.libc.
  
  PR:		215105
  Submitted by:	<jtd2004a sbcglobal.net>

Modified:
  head/lib/libc/net/linkaddr.c

Modified: head/lib/libc/net/linkaddr.c
==============================================================================
--- head/lib/libc/net/linkaddr.c	Wed Dec  7 22:52:12 2016	(r309687)
+++ head/lib/libc/net/linkaddr.c	Wed Dec  7 23:18:00 2016	(r309688)
@@ -125,7 +125,7 @@ link_ntoa(const struct sockaddr_dl *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;
@@ -142,11 +142,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--;
 		}
@@ -154,15 +154,14 @@ 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)
 				break;
 			*out++ = hexlist[i];
-			rem++;
+			rem--;
 		}
 	}
 	*out = 0;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612072318.uB7NI0mf021358>