Skip to content

Commit 8d53e53

Browse files
committed
raster-interpret.c: Verify base for strtol()
Input for `atoi()` can be bad number for argument `base` in `strtol()`, causing returning an incorrect pointer address and later segfault. Break out from function if the base is incorrect. Fixes OpenPrinting#1188
1 parent 0731f1d commit 8d53e53

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cups/raster-interpret.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1306,10 +1306,10 @@ scan_ps(_cups_ps_stack_t *st, /* I - Stack */
13061306
base = atoi(start);
13071307

13081308
/*
1309-
* strtol() takes 0 or 2 to 32 as base...
1309+
* Postscript language reference manual dictates numbers from 2 to 36 as base...
13101310
*/
13111311

1312-
if (base != 0 && (base < 2 || base > 32))
1312+
if (base < 2 || base > 36)
13131313
return (NULL);
13141314

13151315
obj.value.number = strtol(cur + 1, &cur, base);

0 commit comments

Comments
 (0)