diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2023-11-01 11:05:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-01 11:05:50 +0100 |
commit | 6d08e1c8c96d0327a5b819dc1fbb0d5754f3e2e5 (patch) | |
tree | 575867b1d1eef4cd20215f22f9151ebb4a02c93d /plugins/check_curl.c | |
parent | 03bde80abbda6fba2225568c3285a2ff2b5445a8 (diff) | |
parent | 76d9f25cd0dbe99657baeb6fa139a1831558adae (diff) | |
download | monitoring-plugins-6d08e1c.tar.gz |
Merge branch 'master' into fix_check_mailq
Diffstat (limited to 'plugins/check_curl.c')
-rw-r--r-- | plugins/check_curl.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c index 153e492f..9c0dc349 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c | |||
@@ -1186,16 +1186,16 @@ int | |||
1186 | uri_strcmp (const UriTextRangeA range, const char* s) | 1186 | uri_strcmp (const UriTextRangeA range, const char* s) |
1187 | { | 1187 | { |
1188 | if (!range.first) return -1; | 1188 | if (!range.first) return -1; |
1189 | if (range.afterLast - range.first < strlen (s)) return -1; | 1189 | if ( (size_t)(range.afterLast - range.first) < strlen (s) ) return -1; |
1190 | return strncmp (s, range.first, min( range.afterLast - range.first, strlen (s))); | 1190 | return strncmp (s, range.first, min( (size_t)(range.afterLast - range.first), strlen (s))); |
1191 | } | 1191 | } |
1192 | 1192 | ||
1193 | char* | 1193 | char* |
1194 | uri_string (const UriTextRangeA range, char* buf, size_t buflen) | 1194 | uri_string (const UriTextRangeA range, char* buf, size_t buflen) |
1195 | { | 1195 | { |
1196 | if (!range.first) return "(null)"; | 1196 | if (!range.first) return "(null)"; |
1197 | strncpy (buf, range.first, max (buflen-1, range.afterLast - range.first)); | 1197 | strncpy (buf, range.first, max (buflen-1, (size_t)(range.afterLast - range.first))); |
1198 | buf[max (buflen-1, range.afterLast - range.first)] = '\0'; | 1198 | buf[max (buflen-1, (size_t)(range.afterLast - range.first))] = '\0'; |
1199 | buf[range.afterLast - range.first] = '\0'; | 1199 | buf[range.afterLast - range.first] = '\0'; |
1200 | return buf; | 1200 | return buf; |
1201 | } | 1201 | } |
@@ -2368,8 +2368,7 @@ remove_newlines (char *s) | |||
2368 | char * | 2368 | char * |
2369 | get_header_value (const struct phr_header* headers, const size_t nof_headers, const char* header) | 2369 | get_header_value (const struct phr_header* headers, const size_t nof_headers, const char* header) |
2370 | { | 2370 | { |
2371 | int i; | 2371 | for(size_t i = 0; i < nof_headers; i++ ) { |
2372 | for( i = 0; i < nof_headers; i++ ) { | ||
2373 | if(headers[i].name != NULL && strncasecmp( header, headers[i].name, max( headers[i].name_len, 4 ) ) == 0 ) { | 2372 | if(headers[i].name != NULL && strncasecmp( header, headers[i].name, max( headers[i].name_len, 4 ) ) == 0 ) { |
2374 | return strndup( headers[i].value, headers[i].value_len ); | 2373 | return strndup( headers[i].value, headers[i].value_len ); |
2375 | } | 2374 | } |
@@ -2471,7 +2470,7 @@ check_document_dates (const curlhelp_write_curlbuf *header_buf, char (*msg)[DEFA | |||
2471 | int | 2470 | int |
2472 | get_content_length (const curlhelp_write_curlbuf* header_buf, const curlhelp_write_curlbuf* body_buf) | 2471 | get_content_length (const curlhelp_write_curlbuf* header_buf, const curlhelp_write_curlbuf* body_buf) |
2473 | { | 2472 | { |
2474 | int content_length = 0; | 2473 | size_t content_length = 0; |
2475 | struct phr_header headers[255]; | 2474 | struct phr_header headers[255]; |
2476 | size_t nof_headers = 255; | 2475 | size_t nof_headers = 255; |
2477 | size_t msglen; | 2476 | size_t msglen; |