1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 21:08:08 +01:00

util: replaced sprintf with snprintf to avoid buffer overflow (Coverity #50220)

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-06-16 20:15:27 +02:00
committed by Carlos R. Mafra
parent 36ac3b3344
commit 8e9c06627d

View File

@@ -121,7 +121,10 @@ int main(int argc, char **argv)
file = fopen(filename, "rb"); file = fopen(filename, "rb");
if (!file) { if (!file) {
char line[1024]; char line[1024];
sprintf(line, "%s: could not open \"%s\"", __progname, filename);
snprintf(line, sizeof(line),
"%s: could not open \"%s\"",
__progname, filename);
perror(line); perror(line);
exit(1); exit(1);
} }