mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-06-11 09:40:05 -04:00
check_http: Handle chunked encoding without actual content correctly
This commit is contained in:
parent
fc8a233854
commit
6d3e44d2d8
1 changed files with 7 additions and 1 deletions
|
|
@ -1462,7 +1462,13 @@ char *unchunk_content(const char *content) {
|
|||
memcpy(result + (overall_size - size_of_chunk), start_of_chunk, size_of_chunk);
|
||||
}
|
||||
|
||||
result[overall_size] = '\0';
|
||||
if (overall_size == 0 && result == NULL) {
|
||||
// We might just have received the end chunk without previous content, so result is never allocated
|
||||
result = calloc(1, sizeof(char));
|
||||
// No error handling here, we can only return NULL anyway
|
||||
} else {
|
||||
result[overall_size] = '\0';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue