From: plazmus Date: Thu, 31 Dec 2009 09:00:25 +0000 (+0100) Subject: apache plugin: Fix a segmentation fault in the config handling of VerifyPeer / Verify... X-Git-Tag: collectd-4.9.1~8 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6254a763a3103ee0d3a09726da53dfc8b3bc8dbc;p=collectd.git apache plugin: Fix a segmentation fault in the config handling of VerifyPeer / VerifyHost. Hello, Today I upgraded a machine from 4.5.2 to 4.9.0. Everything went fine, but the new version segfaults immediately at startup. With some help from gdb I tracked down the problem to the apache module. It will occur if one tries to use the VerifyPeer/VerifyHost options (I guess few people use these as I don't see complaints?) When the plugin attempts to read the value of a boolean option, instead of using the pre-parsed int value, it misdetects the type of the option (seems a mechanical mistake) and tries to use the string pointer, which is actually NULL. I'm sending a patch, it's actually shorter than the description ;) Thanks to all developers and maintainers of collectd for working on it. Have a nice holidays. --- diff --git a/src/apache.c b/src/apache.c index df1b560f..d6712dcb 100644 --- a/src/apache.c +++ b/src/apache.c @@ -202,7 +202,7 @@ static int config_set_boolean (int *ret_boolean, /* {{{ */ return (-1); } - if (ci->values[0].type != OCONFIG_TYPE_BOOLEAN) + if (ci->values[0].type == OCONFIG_TYPE_BOOLEAN) { if (ci->values[0].value.boolean) *ret_boolean = 1;