Skip to content

Commit

Permalink
jp3d: Replace sprintf() by snprintf() in volumetobin()
Browse files Browse the repository at this point in the history
This replaces the unsafe sprintf() invocation by the safer snprintf()
one, with the correct buffer size to prevent buffer overflows.

This fixes uclouvain#1085.
  • Loading branch information
kbabioch committed Mar 3, 2018
1 parent 564fbfb commit e351c22
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bin/jp3d/convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e351c22

Please sign in to comment.