diff --git a/cups/raster-interpret.c b/cups/raster-interpret.c index 70cf989fcd..b34a5c367c 100644 --- a/cups/raster-interpret.c +++ b/cups/raster-interpret.c @@ -1115,7 +1115,19 @@ scan_ps(_cups_ps_stack_t *st, /* I - Stack */ cur ++; - if (*cur == 'b') + /* + * Return NULL if we reached NULL terminator, a lone backslash + * is not a valid character in PostScript. + */ + + if (!*cur) + { + *ptr = NULL; + + return (NULL); + } + + if (*cur == 'b') *valptr++ = '\b'; else if (*cur == 'f') *valptr++ = '\f';