summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a3899e5)
raw | patch | inline | side by side (parent: a3899e5)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 23 Nov 2014 12:47:52 +0000 (13:47 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 23 Nov 2014 12:47:52 +0000 (13:47 +0100) |
Upstream fix for a segfault when including empty config files. Thanks to Bernd
Zeimetz and Marc Fournier for reporting this.
Closes: #750440, #770685
Zeimetz and Marc Fournier for reporting this.
Closes: #750440, #770685
debian/changelog | patch | blob | history | |
debian/patches/00list | patch | blob | history | |
debian/patches/bts750440_config_segfault.dpatch | [new file with mode: 0755] | patch | blob |
diff --git a/debian/changelog b/debian/changelog
index dc739f29ddcf4c51724e384c6fb1c0ee63d0b1a2..cb8bac328b33ab0cd0b2dda255750023dddc8695 100644 (file)
--- a/debian/changelog
+++ b/debian/changelog
- Added bts770683_curl_init: upstream fix for a segfault in plugins using
libcurl caused by concurrent memory access; thanks to Marc Fournier for
reporting this (Closes: #770683, cf. #735173).
+ - Added bts750440_config_segfault: upstream fix for a segfault when
+ including empty config files; thanks to Bernd Zeimetz and Marc Fournier
+ for reporting this (Closes: #750440, #770685).
-- Sebastian Harl <tokkee@debian.org> Sun, 23 Nov 2014 13:04:03 +0100
diff --git a/debian/patches/00list b/debian/patches/00list
index 5046f3e3482a4cb901bdf09fe6bc45f3a24fb613..bb9acff916e2241f4b9fd9a35395e1fc7b639f23 100644 (file)
--- a/debian/patches/00list
+++ b/debian/patches/00list
bts770681_riemann_ack.dpatch
bts747093_lvm_segfault.dpatch
bts770683_curl_init.dpatch
+bts750440_config_segfault.dpatch
diff --git a/debian/patches/bts750440_config_segfault.dpatch b/debian/patches/bts750440_config_segfault.dpatch
--- /dev/null
@@ -0,0 +1,38 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## bts750440_config_segfault.dpatch by Wilfried Goesgens <dothebart@citadel.org>
+##
+## DP: Fixed a segfault when handling/including empty config files.
+## DP:
+## DP: Correctly handle the case of empty "children" nodes.
+## DP:
+## DP: Upstream bug report:
+## DP: https://github.com/collectd/collectd/issues/638
+
+@DPATCH@
+
+diff a/src/configfile.c b/src/configfile.c
+--- a/src/configfile.c
++++ b/src/configfile.c
+@@ -414,6 +414,12 @@ static int cf_ci_replace_child (oconfig_item_t *dst, oconfig_item_t *src,
+
+ /* Resize the memory containing the children to be big enough to hold
+ * all children. */
++ if (dst->children_num + src->children_num - 1 == 0)
++ {
++ dst->children_num = 0;
++ return (0);
++ }
++
+ temp = (oconfig_item_t *) realloc (dst->children,
+ sizeof (oconfig_item_t)
+ * (dst->children_num + src->children_num - 1));
+@@ -514,7 +520,8 @@ static int cf_include_all (oconfig_item_t *root, int depth)
+ continue;
+
+ /* Now replace the i'th child in `root' with `new'. */
+- cf_ci_replace_child (root, new, i);
++ if (cf_ci_replace_child (root, new, i) < 0)
++ return (-1);
+
+ /* ... and go back to the new i'th child. */
+ --i;