Skip to content

Commit

Permalink
ppd-emit.c: Fix crash if there is no page size for "Custom" (#35)
Browse files Browse the repository at this point in the history
Original report/fix: OpenPrinting/cups#849
  • Loading branch information
zdohnal authored Jan 5, 2024
1 parent 24839b5 commit 32eea8a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ppd/ppd-emit.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,19 +949,24 @@ ppdEmitString(ppd_file_t *ppd, // I - PPD file record
// parameter positions defined in the PPD file...
//

ppd_attr_t *attr; // PPD attribute
ppd_attr_t *attr; // PPD attribute
int pos, // Position of custom value
orientation; // Orientation to use
float values[5]; // Values for custom command


strlcpy(bufptr, "%%BeginFeature: *CustomPageSize True\n",
strlcpy(bufptr, "%%BeginFeature: *CustomPageSize True\n",
(size_t)(bufend - bufptr + 1));
bufptr += 37;

size = ppdPageSize(ppd, "Custom");
if ((size = ppdPageSize(ppd, "Custom")) == NULL)
{
free(buffer);
free(choices);
return (NULL);
}

memset(values, 0, sizeof(values));
memset(values, 0, sizeof(values));

if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Width")) != NULL)
{
Expand Down

0 comments on commit 32eea8a

Please sign in to comment.