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:
Karol Babioch 2018-03-03 10:10:32 +01:00
parent 564fbfb678
commit e351c22ee8
1 changed files with 1 additions and 1 deletions

View File

@ -788,7 +788,7 @@ int volumetobin(opj_volume_t * volume, char *outfile)
fclose(fdest);
sprintf(name, "%s.img", outfile);
snprintf(name, sizeof(name), "%s.img", outfile);
fimgdest = fopen(name, "w");
if (!fimgdest) {
fprintf(stdout, "[ERROR] Failed to open %s for writing\n", name);