Skip to content

Fix: ppdLutLoad() returning NULL due to undersized spec buffer#72

Merged
tillkamppeter merged 1 commit into
OpenPrinting:masterfrom
rkt0209:fix-ppd-load-profile-spec-size
May 30, 2026
Merged

Fix: ppdLutLoad() returning NULL due to undersized spec buffer#72
tillkamppeter merged 1 commit into
OpenPrinting:masterfrom
rkt0209:fix-ppd-load-profile-spec-size

Conversation

@rkt0209
Copy link
Copy Markdown
Contributor

@rkt0209 rkt0209 commented May 30, 2026

Problem

ppdLutLoad() in ppd/ppd-load-profile.c declares its spec[] buffer as PPD_MAX_NAME (41 bytes), then passes that buffer to ppdFindColorAttr(). But ppdFindColorAttr()
rejects any caller whose specsize < IPP_MAX_NAME (256 bytes):

// ppd/ppd-load-profile.c (current master), lines 55-57
if (!ppd || !name || !colormodel || !media || !resolution || !spec ||
    specsize < IPP_MAX_NAME)
  return (NULL);

As a result, every call to ppdLutLoad() returns NULL — the function is effectively dead code on master. Any printer driver that relies on cups*Dither /
cupsAllDither PPD attributes for halftone LUT loading silently gets no LUT.

The sibling functions in the same file (ppdRGBLoad() at line 193, ppdCMYKLoad() at line 311) already declare their spec[] buffer as IPP_MAX_NAME, so this is clearly an
oversight in ppdLutLoad() alone.

Fix

Change one character — make ppdLutLoad's spec buffer IPP_MAX_NAME to match what ppdFindColorAttr() requires.

   char               name[PPD_MAX_NAME],     // Attribute name
-             spec[PPD_MAX_NAME];     // Attribute spec
+             spec[IPP_MAX_NAME];     // Attribute spec

No API change, no behaviour change for callers that were already getting NULL — they now get the LUT the function was always meant to return.

@tillkamppeter tillkamppeter merged commit 2914b19 into OpenPrinting:master May 30, 2026
3 checks passed
rkt0209 added a commit to rkt0209/libppd that referenced this pull request May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants