From e78b37b25c27d74c1ecd34f8a23f2bedea22f791 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Sun, 26 Oct 2014 17:12:34 +0200 Subject: [PATCH] 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 --- rrdtool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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); -- 2.45.0