Bug 256794 - netstat -c issues
Summary: netstat -c issues
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2021-06-23 19:49 UTC by Nick Reilly
Modified: 2021-06-23 19:49 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Nick Reilly 2021-06-23 19:49:59 UTC
In usr.bin/netstat/inet.c protopr() uses so unitialized. Block beginning at line 242

	if (cflag || Cflag) {
		fnamelen = strlen("Stack");
		cnamelen = strlen("CC");
		oxig = xig = (struct xinpgen *)buf;
		for (xig = (struct xinpgen*)((char *)xig + xig->xig_len);
		    xig->xig_len > sizeof(struct xinpgen);
		    xig = (struct xinpgen *)((char *)xig + xig->xig_len)) {
			if (istcp) {
				tp = (struct xtcpcb *)xig;
				inp = &tp->xt_inp;
			} else {
			if (so->xso_protocol != proto)

Looking at the next block suggests that it is missing:
                        so = &inp->xi_socket;

Also while "-c" is documented in the netstat.1 at line 175, it's missing from the Synopsis at line 42 and line 114