summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/check_dns.c11
1 files changed, 10 insertions, 1 deletions
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)
139 address = strdup (temp_buffer); 139 address = strdup (temp_buffer);
140 strip (address); 140 strip (address);
141 if (address==NULL || strlen(address)==0) 141 if (address==NULL || strlen(address)==0)
142 terminate (STATE_CRITICAL, "DNS CRITICAL - '%s' returned empty host name string", NSLOOKUP_COMMAND); 142 terminate (STATE_CRITICAL,
143 "DNS CRITICAL - '%s' returned empty host name string\n",
144 NSLOOKUP_COMMAND);
143 result = STATE_OK; 145 result = STATE_OK;
144 } 146 }
145 else { 147 else {
@@ -176,6 +178,13 @@ main (int argc, char **argv)
176 output = strscpy (output, "nslookup returned error status"); 178 output = strscpy (output, "nslookup returned error status");
177 } 179 }
178 180
181 /* If we got here, we should have an address string,
182 and we can segfault if we do not */
183 if (address==NULL || strlen(address)==0)
184 terminate (STATE_CRITICAL,
185 "DNS CRITICAL - '%s' output parsing exited with no address\n",
186 NSLOOKUP_COMMAND);
187
179 /* compare to expected address */ 188 /* compare to expected address */
180 if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) { 189 if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) {
181 result = STATE_CRITICAL; 190 result = STATE_CRITICAL;