]> granicus.if.org Git - graphviz/commitdiff
use safer snprintf in write_nodename()
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 24 Oct 2020 17:13:39 +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 0f432c98089beb81c8501c3a1e053b4ac4d32555..4b3d8f7b987c8d87d7824ac0bd15973d024df5d4 100644 (file)
@@ -506,7 +506,7 @@ static int write_nodename(Agnode_t * n, iochan_t * ofile)
        CHKRV(write_canonstr(g, ofile, name));
     } else {
        char buf[sizeof("__SUSPECT") + 20];
-       sprintf(buf, "_%ld_SUSPECT", AGID(n));  /* could be deadly wrong */
+       snprintf(buf, sizeof(buf), "_%ld_SUSPECT", AGID(n));    /* could be deadly wrong */
        CHKRV(ioput(g, ofile, buf));
     }
     return 0;