Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net-mgmt/monitoring-plugins: fix a check_http problem
Updated monitoring-plugins to 2.3.3 and noticed check_http was segfaulting on some checks. Issue was already reported upstream and fixed: monitoring-plugins/monitoring-plugins#1840 PR: 269747 Sponsored by: Netzkommune GmbH
- Loading branch information
Showing
2 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
net-mgmt/monitoring-plugins/files/patch-plugins_check__http.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
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; | ||
} |