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
This commit is contained in:
Pedro F. Giffuni 2016-03-27 20:02:21 +00:00
parent 2f396d3cc3
commit cfe3da09e2
1 changed files with 1 additions and 0 deletions

View File

@ -417,6 +417,7 @@ p_sockaddr(const char *name, struct sockaddr *sa, struct sockaddr *mask,
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}{]:} ",