OpenPrinting / OpenPrinting/cups-filters

Potential NULL pointer dereference cases

Open Beginner friendly
#697 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
197
Forks
158
Avg merge
3h 29m
Merged PRs (30d)
1

Description

Hello! I found some issues via a SAST tool. They are not critical, but I hope this information could be useful.

There are two potential NULL pointer dereference cases:

  1. filter/rastertopclx.c

ppdLutLoad() and cfLutNew() can return NULL if the nested calloc() function fails. There is no check on line 443:

https://github.com/OpenPrinting/cups-filters/blob/75e4bd9fa9da584948c8c00117a5d5542beb5b7b/filter/rastertopclx.c#L433-L443

Add a NULL check of cfLutNew() result.

  1. filter/foomatic-rip/spooler.c

The HOME environment variable is usually defined in user environments, but this isn't guaranteed.

https://github.com/OpenPrinting/cups-filters/blob/75e4bd9fa9da584948c8c00117a5d5542beb5b7b/filter/foomatic-rip/spooler.c#L229

Add a NULL check of getenv("HOME") result.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the cited sections of filter/rastertopclx.c around line 443 and filter/foomatic-rip/spooler.c around line 229. Trace the return values from cfLutNew() and getenv("HOME") and review nearby error-handling conventions. Done means both potential NULL cases are handled without dereferencing NULL.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.