diff options
author | Sven Nierlein <sven@nierlein.de> | 2021-03-11 13:33:16 +0100 |
---|---|---|
committer | Jan Wagner <waja@cyconet.org> | 2021-04-10 13:43:12 +0200 |
commit | 2bb6abb501cdcace5808fad89f1941f36c69fbf5 (patch) | |
tree | bf2494e4dc6774a921544ec0c9628da0baba8934 /plugins/check_curl.c | |
parent | 7c32e6454000436086385be924dee74ee0fe1e8d (diff) | |
download | monitoring-plugins-2bb6abb501cdcace5808fad89f1941f36c69fbf5.tar.gz |
fix check_curl crash if http header contains leading spaces
check_curl crashes when a (broken) http server returns invalid http header with
leading spaces or double colons. This PR adds a fix and a test case for this.
Signed-off-by: Sven Nierlein <sven@nierlein.de>
Diffstat (limited to 'plugins/check_curl.c')
-rw-r--r-- | plugins/check_curl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c index 8f274c26..9f1eafa2 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c | |||
@@ -2060,7 +2060,7 @@ get_header_value (const struct phr_header* headers, const size_t nof_headers, co | |||
2060 | { | 2060 | { |
2061 | int i; | 2061 | int i; |
2062 | for( i = 0; i < nof_headers; i++ ) { | 2062 | for( i = 0; i < nof_headers; i++ ) { |
2063 | if( strncasecmp( header, headers[i].name, max( headers[i].name_len, 4 ) ) == 0 ) { | 2063 | if(headers[i].name != NULL && strncasecmp( header, headers[i].name, max( headers[i].name_len, 4 ) ) == 0 ) { |
2064 | return strndup( headers[i].value, headers[i].value_len ); | 2064 | return strndup( headers[i].value, headers[i].value_len ); |
2065 | } | 2065 | } |
2066 | } | 2066 | } |