From: Claudius Zingerli Date: Tue, 5 Jan 2016 17:22:22 +0000 (+0100) Subject: Fixed rrdtool sigsegv (datadir==NULL ptr dereferencing) X-Git-Tag: collectd-5.5.1~6^2~10 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5d5e6749dde4cccc5616df8536775d0f237df5e9;p=collectd.git Fixed rrdtool sigsegv (datadir==NULL ptr dereferencing) --- diff --git a/src/rrdtool.c b/src/rrdtool.c index 9b04d10e..7cfdae60 100644 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@ -1018,11 +1018,11 @@ static int rrd_config (const char *key, const char *value) return (1); } - len = strlen (datadir); - while ((len > 0) && (datadir[len - 1] == '/')) + len = strlen (tmp); + while ((len > 0) && (tmp[len - 1] == '/')) { len--; - datadir[len] = 0; + tmp[len] = 0; } if (len == 0) @@ -1032,7 +1032,11 @@ static int rrd_config (const char *key, const char *value) return (1); } - sfree (datadir); + if (datadir != NULL) + { + sfree (datadir); + } + datadir = tmp; } else if (strcasecmp ("StepSize", key) == 0)