summaryrefslogtreecommitdiffstats
path: root/plugins/check_http.c
diff options
context:
space:
mode:
authorLorenz <12514511+RincewindsHat@users.noreply.github.com>2023-02-06 13:06:10 +0100
committerGitHub <noreply@github.com>2023-02-06 13:06:10 +0100
commite0dfb0622d19a4b4340dab9a315cb4b649f6f1e4 (patch)
tree21ccc76338be77623013b0cb0ce6f472381340e3 /plugins/check_http.c
parent843f17918886edd5c8d14e5a9967785c654053c8 (diff)
parent03efbb8e4f736bf2df5d9477dd4191501fe035ea (diff)
downloadmonitoring-plugins-e0dfb0622d19a4b4340dab9a315cb4b649f6f1e4.tar.gz
Merge pull request #1840 from RincewindsHat/check_http_end_chunk_only
check_http: fix for single zero size chunk only
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r--plugins/check_http.c8
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