diff --git a/bootstrap.conf b/bootstrap.conf index 2450ff07..1e58284a 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -17,7 +17,7 @@ # gnulib modules used by this package. gnulib_modules=' - argmatch array-list assert + argmatch array-list assert assure bitsetv calloc-posix close closeout config-h c-strcase configmake diff --git a/lib/.gitignore b/lib/.gitignore index 919f23c4..b6fc6fe8 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -318,3 +318,4 @@ /rename.c /rmdir.c /same-inode.h +/assure.h diff --git a/src/symtab.c b/src/symtab.c index 0941d2b5..14c672b6 100644 --- a/src/symtab.c +++ b/src/symtab.c @@ -23,6 +23,7 @@ #include "system.h" +#include #include #include "complain.h" @@ -865,9 +866,9 @@ dummy_symbol_get (location loc) { /* Incremented for each generated symbol. */ static int dummy_count = 0; - static char buf[256]; - - sprintf (buf, "$@%d", ++dummy_count); + char buf[32]; + int len = snprintf (buf, sizeof buf, "$@%d", ++dummy_count); + assure (len < sizeof buf); symbol *sym = symbol_get (buf, loc); sym->content->class = nterm_sym; sym->content->number = nvars++;