diff options
-rw-r--r-- | plugins/check_dns.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index 19649f50..df8359ca 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
@@ -136,12 +136,14 @@ main (int argc, char **argv) | |||
136 | /* Strip leading spaces */ | 136 | /* Strip leading spaces */ |
137 | for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++) | 137 | for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++) |
138 | /* NOOP */; | 138 | /* NOOP */; |
139 | address = strscpy (address, temp_buffer); | 139 | address = strdup (temp_buffer); |
140 | strip (address); | 140 | strip (address); |
141 | if (address==NULL || strlen(address)==0) | ||
142 | terminate (STATE_CRITICAL, "DNS CRITICAL - '%s' returned empty host name string", %s); | ||
141 | result = STATE_OK; | 143 | result = STATE_OK; |
142 | } | 144 | } |
143 | else { | 145 | else { |
144 | output = strscpy (output, "Unknown error (plugin)"); | 146 | output = strdup ("Unknown error (plugin)"); |
145 | result = STATE_WARNING; | 147 | result = STATE_WARNING; |
146 | } | 148 | } |
147 | 149 | ||
@@ -176,9 +178,9 @@ main (int argc, char **argv) | |||
176 | 178 | ||
177 | /* compare to expected address */ | 179 | /* compare to expected address */ |
178 | if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) { | 180 | if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) { |
179 | result = STATE_CRITICAL; | 181 | result = STATE_CRITICAL; |
180 | asprintf(&output, "expected %s but got %s", expected_address, address); | 182 | asprintf(&output, "expected %s but got %s", expected_address, address); |
181 | } | 183 | } |
182 | 184 | ||
183 | (void) time (&end_time); | 185 | (void) time (&end_time); |
184 | 186 | ||