diff options
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r-- | plugins/check_http.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c index 5fa310f5..6956a726 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -198,7 +198,7 @@ test_file (char *path) | |||
198 | 198 | ||
199 | /* | 199 | /* |
200 | * process command-line arguments | 200 | * process command-line arguments |
201 | * returns true on succes, false otherwise | 201 | * returns true on success, false otherwise |
202 | */ | 202 | */ |
203 | bool process_arguments (int argc, char **argv) | 203 | bool process_arguments (int argc, char **argv) |
204 | { | 204 | { |
@@ -1391,7 +1391,6 @@ char *unchunk_content(const char *content) { | |||
1391 | // https://en.wikipedia.org/wiki/Chunked_transfer_encoding | 1391 | // https://en.wikipedia.org/wiki/Chunked_transfer_encoding |
1392 | // https://www.rfc-editor.org/rfc/rfc7230#section-4.1 | 1392 | // https://www.rfc-editor.org/rfc/rfc7230#section-4.1 |
1393 | char *result = NULL; | 1393 | char *result = NULL; |
1394 | size_t content_length = strlen(content); | ||
1395 | char *start_of_chunk; | 1394 | char *start_of_chunk; |
1396 | char* end_of_chunk; | 1395 | char* end_of_chunk; |
1397 | long size_of_chunk; | 1396 | long size_of_chunk; |
@@ -1462,7 +1461,13 @@ char *unchunk_content(const char *content) { | |||
1462 | memcpy(result + (overall_size - size_of_chunk), start_of_chunk, size_of_chunk); | 1461 | memcpy(result + (overall_size - size_of_chunk), start_of_chunk, size_of_chunk); |
1463 | } | 1462 | } |
1464 | 1463 | ||
1465 | result[overall_size] = '\0'; | 1464 | if (overall_size == 0 && result == NULL) { |
1465 | // We might just have received the end chunk without previous content, so result is never allocated | ||
1466 | result = calloc(1, sizeof(char)); | ||
1467 | // No error handling here, we can only return NULL anyway | ||
1468 | } else { | ||
1469 | result[overall_size] = '\0'; | ||
1470 | } | ||
1466 | return result; | 1471 | return result; |
1467 | } | 1472 | } |
1468 | 1473 | ||
@@ -1879,7 +1884,7 @@ print_usage (void) | |||
1879 | printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); | 1884 | printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); |
1880 | printf (" [-J <client certificate file>] [-K <private key>]\n"); | 1885 | printf (" [-J <client certificate file>] [-K <private key>]\n"); |
1881 | printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-E] [-a auth]\n"); | 1886 | printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-E] [-a auth]\n"); |
1882 | printf (" [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]\n"); | 1887 | printf (" [-b proxy_auth] [-f <ok|warning|critical|follow|sticky|stickyport>]\n"); |
1883 | printf (" [-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); | 1888 | printf (" [-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); |
1884 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); | 1889 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); |
1885 | printf (" [-A string] [-k string] [-S <version>] [--sni]\n"); | 1890 | printf (" [-A string] [-k string] [-S <version>] [--sni]\n"); |