bin/130300: netstat crash when params is incorrect

Ruslan Ermilov ru at FreeBSD.org
Sat Jan 10 05:10:03 PST 2009


The following reply was made to PR bin/130300; it has been noted by GNATS.

From: Ruslan Ermilov <ru at FreeBSD.org>
To: Li yonggang <leeygang at gmail.com>
Cc: bug-followup at FreeBSD.org
Subject: Re: bin/130300: netstat crash when params is incorrect
Date: Sat, 10 Jan 2009 15:31:30 +0300

 The problem is not with the backward compatibility code -- you'll
 get the same crash with "netstat -N foo -m" as well.  The proper
 fix is as follows:
 
 %%%
 Index: main.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/netstat/main.c,v
 retrieving revision 1.87.2.1
 diff -u -p -r1.87.2.1 main.c
 --- main.c	16 Mar 2008 07:20:18 -0000	1.87.2.1
 +++ main.c	10 Jan 2009 12:25:32 -0000
 @@ -499,7 +499,7 @@ main(int argc, char *argv[])
  		exit(0);
  	}
  	if (mflag) {
 -		if (memf != NULL) {
 +		if (!live) {
  			if (kread(0, NULL, 0) == 0)
  				mbpr(kvmd, nl[N_MBSTAT].n_value);
  		} else
 %%%
 
 
 Cheers,
 -- 
 Ruslan Ermilov
 ru at FreeBSD.org
 FreeBSD committer


More information about the freebsd-bugs mailing list