bin/130300: netstat crash when params is incorrect

Li yonggang leeygang at gmail.com
Sat Jan 10 06:10:03 PST 2009


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

From: "Li yonggang" <leeygang at gmail.com>
To: "Ruslan Ermilov" <ru at freebsd.org>
Cc: bug-followup at freebsd.org
Subject: Re: bin/130300: netstat crash when params is incorrect
Date: Sat, 10 Jan 2009 22:01:19 +0800

 I dont think netstat -N foo -m and netstat -m foo are exactly the same bug.
 the crash of netstat -N foo -m is caused by not providing -M option to
 specify the dump file, while the crash of netstat -m foo is caused not
 check illegal params.
 but I agree to fix them  in bug 124724 together.
 
 
 On Sat, Jan 10, 2009 at 8:31 PM, Ruslan Ermilov <ru at freebsd.org> wrote:
 > 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