diff options
-rw-r--r-- | plugins/check_http.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c index 5fa310f5..8dda046f 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -1462,7 +1462,13 @@ char *unchunk_content(const char *content) { | |||
1462 | memcpy(result + (overall_size - size_of_chunk), start_of_chunk, size_of_chunk); | 1462 | memcpy(result + (overall_size - size_of_chunk), start_of_chunk, size_of_chunk); |
1463 | } | 1463 | } |
1464 | 1464 | ||
1465 | result[overall_size] = '\0'; | 1465 | if (overall_size == 0 && result == NULL) { |
1466 | // We might just have received the end chunk without previous content, so result is never allocated | ||
1467 | result = calloc(1, sizeof(char)); | ||
1468 | // No error handling here, we can only return NULL anyway | ||
1469 | } else { | ||
1470 | result[overall_size] = '\0'; | ||
1471 | } | ||
1466 | return result; | 1472 | return result; |
1467 | } | 1473 | } |
1468 | 1474 | ||