Skip to content

Commit

Permalink
net-mgmt/monitoring-plugins: fix a check_http problem
Browse files Browse the repository at this point in the history
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
James TD Smith authored and joneum committed Mar 13, 2023
1 parent 5c9cf71 commit 51cbef5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions net-mgmt/monitoring-plugins/Makefile
@@ -1,5 +1,6 @@
PORTNAME= monitoring-plugins
PORTVERSION= 2.3.3
PORTREVISION= 1
CATEGORIES= net-mgmt
MASTER_SITES= https://www.monitoring-plugins.org/download/ \
LOCAL/mat/${PORTNAME}
Expand Down
17 changes: 17 additions & 0 deletions net-mgmt/monitoring-plugins/files/patch-plugins_check__http.c
@@ -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;
}

0 comments on commit 51cbef5

Please sign in to comment.