Date: Sat, 10 Jan 2009 09:20:02 GMT From: Jaakko Heinonen <jh@saunalahti.fi> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/124724: [patch] netstat(1): netstat coredump on -stable Message-ID: <200901100920.n0A9K2xP044942@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/124724; it has been noted by GNATS. From: Jaakko Heinonen <jh@saunalahti.fi> To: Li yonggang <leeygang@gmail.com> Cc: bug-followup@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901100920.n0A9K2xP044942>