svn commit: r297321 - head/usr.bin/netstat

Pedro F. Giffuni pfg at FreeBSD.org
Sun Mar 27 20:02:22 UTC 2016


Author: pfg
Date: Sun Mar 27 20:02:21 2016
New Revision: 297321
URL: https://svnweb.freebsd.org/changeset/base/297321

Log:
  netstat: avoid returning uninitialized value in p_sockaddr().
  
  In the case the width is less than 0, we are returning an uninitialized
  value. For practical purposes the return value is ignored but initialize
  it to avoid trouble.
  
  CID:	1341619

Modified:
  head/usr.bin/netstat/route.c

Modified: head/usr.bin/netstat/route.c
==============================================================================
--- head/usr.bin/netstat/route.c	Sun Mar 27 19:43:26 2016	(r297320)
+++ head/usr.bin/netstat/route.c	Sun Mar 27 20:02:21 2016	(r297321)
@@ -417,6 +417,7 @@ p_sockaddr(const char *name, struct sock
 	if (width < 0) {
 		snprintf(buf, sizeof(buf), "{:%s/%%s} ", name);
 		xo_emit(buf, cp);
+		protrusion = 0;
 	} else {
 		if (Wflag != 0 || numeric_addr) {
 			snprintf(buf, sizeof(buf), "{[:%d}{:%s/%%s}{]:} ",


More information about the svn-src-head mailing list