From 7a34de1c6ace0e8a71a657aea23a36e0862d2d2b Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 24 Oct 2020 10:13:04 -0700 Subject: [PATCH] reduce the scope of buffer in write_nodename() --- lib/cgraph/write.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cgraph/write.c b/lib/cgraph/write.c index caa12db3f..0f432c980 100644 --- a/lib/cgraph/write.c +++ b/lib/cgraph/write.c @@ -497,7 +497,7 @@ static int write_nondefault_attrs(void *obj, iochan_t * ofile, static int write_nodename(Agnode_t * n, iochan_t * ofile) { - char *name, buf[sizeof("__SUSPECT") + 20]; + char *name; Agraph_t *g; name = agnameof(n); @@ -505,6 +505,7 @@ static int write_nodename(Agnode_t * n, iochan_t * ofile) if (name) { CHKRV(write_canonstr(g, ofile, name)); } else { + char buf[sizeof("__SUSPECT") + 20]; sprintf(buf, "_%ld_SUSPECT", AGID(n)); /* could be deadly wrong */ CHKRV(ioput(g, ofile, buf)); } -- 2.40.0