bin/124724: [patch] netstat(1): netstat coredump on -stable

Jaakko Heinonen jh at saunalahti.fi
Sat Jan 10 01:20:03 PST 2009


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

From: Jaakko Heinonen <jh at saunalahti.fi>
To: Li yonggang <leeygang at gmail.com>
Cc: bug-followup at FreeBSD.org
Subject: Re: bin/124724: [patch] netstat(1): netstat coredump on -stable
Date: Sat, 10 Jan 2009 11:11:18 +0200

 Hi,
 
 On 2009-01-09, Li yonggang wrote:
 > your analysis is correct for netstat -m -N foo.
 > but for netstat -m foo.I think it is caused by not checking the input,
 > which is definitely not a good habit and bug latency.
 > So a input check should be done as soon as possible.
 > I combined the fixes of yours and mine to fix these 2 problems.
 
 I am not sure if I understand what you mean with "input checking" but I
 suspect that you mean checking of all command line arguments. netstat
 accepts for example following command line:
 
 $ netstat /boot/kernel/kernel /var/crash/vmcore.1 1 2 3 4 5
 
 It doesn't complain about extra command line arguments.
 
 However I disagree that my analysis is incorrect about the segfault with
 "netstat -m foo" command line. The crash happens in libkvm because
 kvm_openfiles() is called with non-NULL nlistf and NULL memf. My patch
 adds a check for this case and netstat aborts with an error message
 before any kvm(3) calls.
 
 I agree that it may be a good idea to remove the old backward
 compatibility code for an ancient (undocumented?) syntax for specifying
 some parameters without options provided that no one uses the syntax.
 It's also reasonable to give an error if superfluous command line
 arguments are given.
 
 -- 
 Jaakko


More information about the freebsd-bugs mailing list