commit:     56788861591b9cd77eb629026613e038ea18d8c5
Author:     Tomáš Mózes <hydrapolic <AT> gmail <DOT> com>
AuthorDate: Wed Feb  8 11:32:07 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Feb  8 17:15:24 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=56788861

net-analyzer/monitoring-plugins: fix check_http segfault

Closes: https://bugs.gentoo.org/893252
Signed-off-by: Tomáš Mózes <hydrapolic <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/29481
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...onitoring-plugins-fix-check-http-segfault.patch | 23 ++++++++++++++++++++++
 ...3.ebuild => monitoring-plugins-2.3.3-r1.ebuild} |  3 ++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git 
a/net-analyzer/monitoring-plugins/files/monitoring-plugins-fix-check-http-segfault.patch
 
b/net-analyzer/monitoring-plugins/files/monitoring-plugins-fix-check-http-segfault.patch
new file mode 100644
index 000000000000..34e539f51e2d
--- /dev/null
+++ 
b/net-analyzer/monitoring-plugins/files/monitoring-plugins-fix-check-http-segfault.patch
@@ -0,0 +1,23 @@
+https://bugs.gentoo.org/893252
+https://github.com/monitoring-plugins/monitoring-plugins/issues/1836
+https://github.com/monitoring-plugins/monitoring-plugins/commit/6d3e44d2d8395076060e9c741e9b173dc5d57b76
+
+diff --git a/plugins/check_http.c b/plugins/check_http.c
+index 5fa310f5d..8dda046ff 100644
+--- a/plugins/check_http.c
++++ b/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;
+ }
+ 

diff --git a/net-analyzer/monitoring-plugins/monitoring-plugins-2.3.3.ebuild 
b/net-analyzer/monitoring-plugins/monitoring-plugins-2.3.3-r1.ebuild
similarity index 96%
rename from net-analyzer/monitoring-plugins/monitoring-plugins-2.3.3.ebuild
rename to net-analyzer/monitoring-plugins/monitoring-plugins-2.3.3-r1.ebuild
index bf2ccb76116a..555d75dae179 100644
--- a/net-analyzer/monitoring-plugins/monitoring-plugins-2.3.3.ebuild
+++ b/net-analyzer/monitoring-plugins/monitoring-plugins-2.3.3-r1.ebuild
@@ -58,7 +58,8 @@ RDEPEND="${DEPEND}
 RESTRICT="test"
 
 PATCHES=(
-       "${FILESDIR}/monitoring-plugins-gnutls.patch"
+       "${FILESDIR}/${PN}-gnutls.patch" #880211
+       "${FILESDIR}/${PN}-fix-check-http-segfault.patch" #893252
 )
 
 src_configure() {

Reply via email to