]> granicus.if.org Git - graphviz/commitdiff
cgraph storeFileName: fix unchecked allocation failure
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 27 Aug 2022 15:50:12 +0000 (08:50 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 30 Aug 2022 01:19:51 +0000 (18:19 -0700)
lib/cgraph/scan.l

index db6b6be882343553ad37cc7b0ea353ca0677dfb3..078f1671154a4214b6147135b703e19fd9cff40b 100644 (file)
@@ -28,6 +28,7 @@
 #include <cghdr.h>
 #include <agxbuf.h>
 #include <cgraph/agxbuf.h>
+#include <cgraph/alloc.h>
 #include <ctype.h>
 #include <stdbool.h>
 #include <stddef.h>
@@ -98,7 +99,7 @@ storeFileName (char* fname, int len)
     static char* buf;
 
     if (len > cnt) {
-       buf = realloc (buf, len+1);
+       buf = gv_realloc(buf, cnt + 1, len + 1);
        cnt = len;
     }
     strcpy (buf, fname);