[Nagiosplug-devel] [ nagiosplug-Bugs-741296 ] check_dns.c segfault with -a and NXDOMAIN
SourceForge.net
noreply at sourceforge.net
Sat May 31 07:57:04 CEST 2003
Bugs item #741296, was opened at 2003-05-21 14:28
Message generated for change (Comment added) made by kdebisschop
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=741296&group_id=29880
Category: None
Group: CVS
Status: Open
Resolution: None
Priority: 5
Submitted By: David Maynard (dpmaynard)
Assigned to: Karl DeBisschop (kdebisschop)
Summary: check_dns.c segfault with -a and NXDOMAIN
Initial Comment:
check_dns.c 1.13 from CVS compiled and run under
Red Hat 7.1 and testing against bind-8.2.3+patches on
a Cobalt generates a segmentation fault if the requested
domain does not exist and the "-a" flag is specified.
The "address" variable is NULL when the code reaches
line 183 and attempts a strcmp. The null pointer to
strcmp generates a segfault.
Arguably, this is a bug in the parsing of the "address"
variable since it probably shouldn't be a NULL at this
point in the code. However, the code for "-a" is
predicated on STATE_OK, so if something earlier in the
code indicates STATE_WARNING (e.g., because it
detects a NXDOMAIN return), then the "-a" check will
not be performed and Nagios will "miss" the CRITICAL
error. (If I tell it to match an expected address, it is
critical if it doesn't exist.)
As a result, my "fix" (to achieve the results I need), was
to change the code for the "-a" test to include a check
for a null address pointer. My patch attached.
-dpm
----------------------------------------------------------------------
>Comment By: Karl DeBisschop (kdebisschop)
Date: 2003-05-31 10:44
Message:
Logged In: YES
user_id=1671
further testing should my revised patch failed to trap the
condition you had described - I tried to trap the NULL in
the while loop. After testing and rereading your post, I
realized that it was the break in the while() loop that
skipped past the address check.
The code in CVS should not segfault. It will be less
informative than old code in some cases, so I may do a
little more work later. But it should be revady for testing,
in both HEAD and r1_3_0
----------------------------------------------------------------------
Comment By: Karl DeBisschop (kdebisschop)
Date: 2003-05-31 10:00
Message:
Logged In: YES
user_id=1671
IMO, your thoughts about where the true bug lies are correct.
And we know form experince that other implementations will
segfault on your patch because you try to print a null string.
I take you point about failing to note that the address is
null and move the check up to that point in the code.
This is the patch I have applied.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=741296&group_id=29880
More information about the Devel
mailing list