]> granicus.if.org Git - graphviz/commitdiff
reduce the scope of buffer in write_nodename()
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 24 Oct 2020 17:13:04 +0000 (10:13 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 31 Oct 2020 01:46:51 +0000 (18:46 -0700)
lib/cgraph/write.c

index caa12db3f3cbe119d13cfbd1213d228237c92b1f..0f432c98089beb81c8501c3a1e053b4ac4d32555 100644 (file)
@@ -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));
     }