From 94e8989a1bdbb8f2c3d519800667828fce6a1f97 Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Sat, 31 May 2003 14:39:33 +0000 Subject: first revised patch failed to trap the "break" in while() git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/branches/release-1.3.0@527 f882894a-f735-0410-b71e-b25c423dba1c diff --git a/plugins/check_dns.c b/plugins/check_dns.c index b110f02..88ef7d7 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c @@ -139,7 +139,9 @@ main (int argc, char **argv) address = strdup (temp_buffer); strip (address); if (address==NULL || strlen(address)==0) - terminate (STATE_CRITICAL, "DNS CRITICAL - '%s' returned empty host name string", NSLOOKUP_COMMAND); + terminate (STATE_CRITICAL, + "DNS CRITICAL - '%s' returned empty host name string\n", + NSLOOKUP_COMMAND); result = STATE_OK; } else { @@ -176,6 +178,13 @@ main (int argc, char **argv) output = strscpy (output, "nslookup returned error status"); } + /* If we got here, we should have an address string, + and we can segfault if we do not */ + if (address==NULL || strlen(address)==0) + terminate (STATE_CRITICAL, + "DNS CRITICAL - '%s' output parsing exited with no address\n", + NSLOOKUP_COMMAND); + /* compare to expected address */ if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) { result = STATE_CRITICAL; -- cgit v0.10-9-g596f