[Nagiosplug-devel] check_dns bug

Russell Scibetti russell at quadrix.com
Thu Dec 19 15:28:06 CET 2002


I found a bug in check_dns in the 1.3b2 release.  It occurs when you run 
"check_dns -H <sitename>" without specifying a "-s <Nameserver>".  It 
resuts in a segmentation fault

There is code in check_dns that, after going through the know args, 
checks to see if the user has given anything at the commandline without 
a tag.  For example, if you run:

./check_dns -H <domain> <nameserver>   -> no -s tag used

it will work because check_dns looks for extra information in the argv 
array.

However, before it looks, there is no check to make sure that there is 
anything else in the argv array.  So when if looks for the <nameserver> 
when none is specified, it causes a segmentation fault (argv[c] is 
undefined).  In the contect-diff patch I have included, I added a check 
to make sure that there are more arguments provided before trying to use 
them.

Personally, I think it might be a better idea to remove that section 
entirely and force people to use the actual tags (-H, -s, etc).  It 
forces users to stick to the defined nagiosplug standard.  Just my opinion.

One last note.  I have been doing a lot of work looking at the plugins 
lately (I'm actually going to investigate a problem I've have with 
check_ifstatus next).  If there is anything I can do to help the 
nagiosplug project, please let me know.  I would love to do whatever is 
in my power to help out.  Thanks!

-Russell Scibetti

-- 
Russell Scibetti
Quadrix Solutions, Inc.
http://www.quadrix.com
(732) 235-2335, ext. 7038

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: checkdns_diff.patch
URL: <http://nagios-plugins.org/archive/devel/attachments/20021219/26e26576/attachment.ksh>


More information about the Devel mailing list