bug in Nagios plugins plugins/netutils.c

Skip Montanaro skip at pobox.com
Wed Sep 24 23:12:33 CEST 2003


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 sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf




More information about the Developers mailing list