From: Sebastian Harl Date: Thu, 30 Oct 2008 15:27:37 +0000 (+0100) Subject: filecount plugin: Fixed an off-by-one error in the configuration code. X-Git-Tag: collectd-4.5.2~17 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=062a664da9fbf134f816a11f255ef90054a9de08;p=collectd.git filecount plugin: Fixed an off-by-one error in the configuration code. The memory allocated to store the information about configured directories did not take into account the newly added directory. This would cause a segfault at some point of time (when specifying more than four directories in my case). Thanks to Martin Janota for finding and reporting this bug. --- diff --git a/src/filecount.c b/src/filecount.c index 55b3655e..f0713795 100644 --- a/src/filecount.c +++ b/src/filecount.c @@ -371,7 +371,7 @@ static int fc_config_add_dir (oconfig_item_t *ci) fc_directory_conf_t **temp; temp = (fc_directory_conf_t **) realloc (directories, - sizeof (*directories) * directories_num); + sizeof (*directories) * (directories_num + 1)); if (temp == NULL) { ERROR ("filecount plugin: realloc failed.");