From: Timo Kokkonen Date: Sun, 26 Oct 2014 15:12:34 +0000 (+0200) Subject: rrdtool.c: Null terminate process argument list in add_arg X-Git-Url: http://git.itanic.dy.fi/?p=rrdd;a=commitdiff_plain;h=e78b37b25c27d74c1ecd34f8a23f2bedea22f791 rrdtool.c: Null terminate process argument list in add_arg add_arg macro was not null teriminating argument list. Null termination was left as an responsibility for the caller. This is error prone as this requirement is not clear. Add null termination in the add_arg macro so that caller does not need to care about it. Signed-off-by: Timo Kokkonen --- diff --git a/rrdtool.c b/rrdtool.c index 9539c68..df9b5c8 100644 --- a/rrdtool.c +++ b/rrdtool.c @@ -29,6 +29,7 @@ args[argcnt] = argstr + idx; \ idx += sprintf(argstr + idx, fmt, ##arg); \ argcnt++; \ + args[argcnt] = 0; \ argstr[++idx] = 0 int rrdtool_draw_image(struct rrd_image *image) @@ -94,8 +95,6 @@ int rrdtool_draw_image(struct rrd_image *image) add_arg(args, argcnt, argstr, idx, "COMMENT: %s\\c", timestamp); - args[argcnt] = 0; - pid = run(cmd, args); harvest_zombies(pid);