diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-05-06 17:09:04 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-05-06 17:10:37 +0100 |
commit | 43d009b93762d1c69d6f7d08b2fb7962e1ccba78 (patch) | |
tree | acc3df81bf298804b6bd2144ccb1b975ccdc2e88 /devices/gdevijs.c | |
parent | 429bddce6bb0089d247e7bd6c32dbb6b7d7efdeb (diff) | |
download | ghostpdl-43d009b93762d1c69d6f7d08b2fb7962e1ccba78.tar.gz |
Coverity 95029: Out of bounds write in gdevijs.c
While parsing params, if we hit the end of the buffer, stop
rather than trying to write into it.
Diffstat (limited to 'devices/gdevijs.c')
-rw-r--r-- | devices/gdevijs.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/devices/gdevijs.c b/devices/gdevijs.c index c696de527..d312e6b2b 100644 --- a/devices/gdevijs.c +++ b/devices/gdevijs.c @@ -765,10 +765,13 @@ gsijs_set_resolution(gx_device_ijs *ijsdev) if (i == sizeof(buf)) code = IJS_EBUF; - buf[i] = 0; - x_dpi = y_dpi = strtod (buf, &tail); - if (tail == buf) - code = IJS_ESYNTAX; + else + { + buf[i] = 0; + x_dpi = y_dpi = strtod (buf, &tail); + if (tail == buf) + code = IJS_ESYNTAX; + } } else { double x, y; |