Potential NULL pointer dereference cases

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

Nobody has claimed this yet.

Assessment

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

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.

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.

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

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.

More from OpenPrinting/cups-filters

All issues in OpenPrinting/cups-filters

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.