[Nagios-devel] bug in Nagios plugins plugins/netutils.c

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] bug in Nagios plugins plugins/netutils.c

Post by Guest »

I think I found a bug in the Nagios plugins plugins/netutils.c file.
Looking at my_connect(), note that there is a while loop:

while (res) {
/* attempt to create a socket */
...
}

Immediately following that is a call to freeaddrinfo(res). At that point
res is likely to be NULL. On Solaris 8 this results in a SEGV. Maybe it's
okay to pass NULL to freeaddrinfo() on some systems, but Solaris at least
doesn't seem to like it. The freeaddrinfo() manpage is vague enough to make
me always want to test the argument against NULL before making the call.
Changing line 304 to

if (res) freeaddrinfo(res);

solved the problem for me.

--
Skip Montanaro
Got gigs? http://www.musi-cal.com/
http://www.mojam.com/
Got spam? http://spambayes.sf.net/





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked