git: 51cbef51eb08 - main - net-mgmt/monitoring-plugins: fix a check_http problem
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 13 Mar 2023 17:59:43 UTC
The branch main has been updated by joneum:
URL: https://cgit.FreeBSD.org/ports/commit/?id=51cbef51eb08e824165da843a97c388b97cb5522
commit 51cbef51eb08e824165da843a97c388b97cb5522
Author: James TD Smith <ahktenzero+freebsd@mohorovi.cc>
AuthorDate: 2023-03-13 17:57:33 +0000
Commit: Jochen Neumeister <joneum@FreeBSD.org>
CommitDate: 2023-03-13 17:59:23 +0000
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:
https://github.com/monitoring-plugins/monitoring-plugins/pull/1840
PR: 269747
Sponsored by: Netzkommune GmbH
---
net-mgmt/monitoring-plugins/Makefile | 1 +
.../files/patch-plugins_check__http.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/net-mgmt/monitoring-plugins/Makefile b/net-mgmt/monitoring-plugins/Makefile
index 1baf7fda4d0c..aacf9dfddfa7 100644
--- a/net-mgmt/monitoring-plugins/Makefile
+++ b/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}
diff --git a/net-mgmt/monitoring-plugins/files/patch-plugins_check__http.c b/net-mgmt/monitoring-plugins/files/patch-plugins_check__http.c
new file mode 100644
index 000000000000..ce072578398b
--- /dev/null
+++ b/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;
+ }