I managed to get collectd to segfault in a couple of places while
playing with it a bit. The first is in the curl_xml module when the
XPATH expression doesn't quite match the input. The crash occurs on line
407 when instance_node->nodeTab[0] is dereferenced. At this point, all
members of instance_node are 0, so dereferencing the array isn't a good
idea. This patch fixes the problem, although I'm not sure if this
particular case actually deserves its own error message.
Signed-off-by: Florian Forster <octo@collectd.org>
instance_node = instance_node_obj->nodesetval;
tmp_size = (instance_node) ? instance_node->nodeNr : 0;
- if ( (tmp_size == 0) && (is_table) )
+ if (tmp_size <= 0)
{
WARNING ("curl_xml plugin: "
"relative xpath expression for 'InstanceFrom' \"%s\" doesn't match "