mirror of
https://git.freebsd.org/ports.git
synced 2025-04-30 18:46:38 -04:00
Updated monitoring-plugins to 2.3.3 and noticed check_http was segfaulting on some checks. Issue was already reported upstream and fixed: https://github.com/monitoring-plugins/monitoring-plugins/pull/1840 PR: 269747 Sponsored by: Netzkommune GmbH
17 lines
627 B
C
17 lines
627 B
C
diff --git a/plugins/check_http.c b/plugins/check_http.c
|
|
--- plugins/check_http.c.old
|
|
+++ plugins/check_http.c
|
|
@@ -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;
|
|
}
|