jp3d: Replace sprintf() by snprintf() in volumetobin()
This replaces the unsafe sprintf() invocation by the safer snprintf() one, with the correct buffer size to prevent buffer overflows. This fixes #1085.
This commit is contained in:
parent
564fbfb678
commit
e351c22ee8
|
@ -788,7 +788,7 @@ int volumetobin(opj_volume_t * volume, char *outfile)
|
||||||
|
|
||||||
fclose(fdest);
|
fclose(fdest);
|
||||||
|
|
||||||
sprintf(name, "%s.img", outfile);
|
snprintf(name, sizeof(name), "%s.img", outfile);
|
||||||
fimgdest = fopen(name, "w");
|
fimgdest = fopen(name, "w");
|
||||||
if (!fimgdest) {
|
if (!fimgdest) {
|
||||||
fprintf(stdout, "[ERROR] Failed to open %s for writing\n", name);
|
fprintf(stdout, "[ERROR] Failed to open %s for writing\n", name);
|
||||||
|
|
Loading…
Reference in New Issue