pgxtoimage(): fix write stack buffer overflow (#997)

This commit is contained in:
Even Rouault 2017-08-18 13:39:20 +02:00
parent 5597522cac
commit e528531922
1 changed files with 1 additions and 1 deletions

View File

@ -1185,7 +1185,7 @@ opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters)
} }
fseek(f, 0, SEEK_SET); fseek(f, 0, SEEK_SET);
if (fscanf(f, "PG%[ \t]%c%c%[ \t+-]%d%[ \t]%d%[ \t]%d", temp, &endian1, if (fscanf(f, "PG%31[ \t]%c%c%31[ \t+-]%d%31[ \t]%d%31[ \t]%d", temp, &endian1,
&endian2, signtmp, &prec, temp, &w, temp, &h) != 9) { &endian2, signtmp, &prec, temp, &w, temp, &h) != 9) {
fclose(f); fclose(f);
fprintf(stderr, fprintf(stderr,