summaryrefslogtreecommitdiffstats
path: root/plugins/check_curl.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_curl.c')
-rw-r--r--plugins/check_curl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 19f80b7..8125ee8 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -314,8 +314,8 @@ static char *string_statuscode (int major, int minor)
314 /* assuming here HTTP/N with N>=4 */ 314 /* assuming here HTTP/N with N>=4 */
315 snprintf (buf, sizeof (buf), "HTTP/%d", major); 315 snprintf (buf, sizeof (buf), "HTTP/%d", major);
316 break; 316 break;
317 } 317 }
318 318
319 return buf; 319 return buf;
320} 320}
321 321
@@ -665,7 +665,7 @@ check_http (void)
665 /* Curl errors, result in critical Nagios state */ 665 /* Curl errors, result in critical Nagios state */
666 if (res != CURLE_OK) { 666 if (res != CURLE_OK) {
667 snprintf (msg, DEFAULT_BUFFER_SIZE, _("Invalid HTTP response received from host on port %d: cURL returned %d - %s"), 667 snprintf (msg, DEFAULT_BUFFER_SIZE, _("Invalid HTTP response received from host on port %d: cURL returned %d - %s"),
668 server_port, res, curl_easy_strerror(res)); 668 server_port, res, errbuf[0] ? errbuf : curl_easy_strerror(res));
669 die (STATE_CRITICAL, "HTTP CRITICAL - %s\n", msg); 669 die (STATE_CRITICAL, "HTTP CRITICAL - %s\n", msg);
670 } 670 }
671 671
@@ -2071,7 +2071,7 @@ get_header_value (const struct phr_header* headers, const size_t nof_headers, co
2071{ 2071{
2072 int i; 2072 int i;
2073 for( i = 0; i < nof_headers; i++ ) { 2073 for( i = 0; i < nof_headers; i++ ) {
2074 if( strncasecmp( header, headers[i].name, max( headers[i].name_len, 4 ) ) == 0 ) { 2074 if(headers[i].name != NULL && strncasecmp( header, headers[i].name, max( headers[i].name_len, 4 ) ) == 0 ) {
2075 return strndup( headers[i].value, headers[i].value_len ); 2075 return strndup( headers[i].value, headers[i].value_len );
2076 } 2076 }
2077 } 2077 }