Does not compile in GCC 9.3.0
StanislavNikolov opened this issue · comments
stjo@stjo-ryzen:~/alfi$ make
CC src/resource.o
src/resource.c: In function ‘_navi_load’:
src/resource.c:221:9: error: format not a string literal and no format arguments [-Werror=format-security]
221 | resource->count = sprintf(buffer, fmt);
| ^~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:22: src/resource.o] Error 1
stjo@stjo-ryzen:~/alfi$ CC=clang make
CC src/resource.o
src/resource.c:256:43: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
resource->count = sprintf(buffer, fmt);
^~~
src/resource.c:256:43: note: treat the string as an argument to avoid this
resource->count = sprintf(buffer, fmt);
^
"%s",
1 error generated.
make: *** [Makefile:22: src/resource.o] Error 1
Ubuntu 20.04
Hi!
I'm not able to reproduce this since I'm on 10.1.0 of gcc right now. If you remove the -Werror flag from the Makefile it should at least compile for you.
I could probably fix this by just adding "%s" as the second argument to sprintf as well in src/resource.c. Could you see if that fixes it for you?