diff options
| author | Robert Ancell <robert.ancell@gmail.com> | 2019-11-17 15:09:59 +1300 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-11-17 03:09:59 +0100 |
| commit | 9701b3305db58d35e4446946309f88937e2f5342 (patch) | |
| tree | c76fccd2c22804ae56572a775d0229eab024741a /src | |
| parent | cb332992a7c84316824b1c4810103ee4f190937c (diff) | |
JPWL: convert: Fix buffer overflow reading an image file less than four characters (#1196)
Fixes #1068
Diffstat (limited to 'src')
| -rw-r--r-- | src/bin/jpwl/convert.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bin/jpwl/convert.c b/src/bin/jpwl/convert.c index 4f636c17..e6feea50 100644 --- a/src/bin/jpwl/convert.c +++ b/src/bin/jpwl/convert.c @@ -1488,7 +1488,7 @@ int imagetopgx(opj_image_t * image, const char *outfile) const size_t olen = strlen(outfile); const size_t dotpos = olen - 4; const size_t total = dotpos + 1 + 1 + 4; /* '-' + '[1-3]' + '.pgx' */ - if (outfile[dotpos] != '.') { + if (olen < 4 || outfile[dotpos] != '.') { /* `pgx` was recognized but there is no dot at expected position */ fprintf(stderr, "ERROR -> Impossible happen."); return 1; |
