Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rip_max_cache is uninitialised, resulting in junk in environment #323

Closed
atsampson opened this issue Jan 12, 2022 · 4 comments
Closed

rip_max_cache is uninitialised, resulting in junk in environment #323

atsampson opened this issue Jan 12, 2022 · 4 comments
Assignees
Labels
bug Something isn't working priority-medium
Milestone

Comments

@atsampson
Copy link

In both scheduler/cupsfilter.c and scheduler/job.c, there's a rip_max_cache variable which gets included in the environment array for subprocesses. However, it's never initialised, so what actually ends up in the environment is some random junk from the stack.

This causes a test failure for me with current master (on amd64 Linux with GCC 11.2), because error.log ends up containing binary junk and the test suite's calls to grep report that it's a binary file.

error.log:

D [12/Jan/2022:11:50:51.840244 +0000] [Job 66] envp[23]="CHARSET=utf-8"
D [12/Jan/2022:11:50:51.840245 +0000] [Job 66] envp[24]="LANG=en.UTF-8"
D [12/Jan/2022:11:50:51.840246 +0000] [Job 66] envp[25]="PPD=/tmp/cups-garstow/ppd/Test1.ppd"
D [12/Jan/2022:11:50:51.840247 +0000] [Job 66] envp[26]="\006ïÔL�"
D [12/Jan/2022:11:50:51.840248 +0000] [Job 66] envp[27]="CONTENT_TYPE=image/jpeg"
D [12/Jan/2022:11:50:51.840249 +0000] [Job 66] envp[28]="DEVICE_URI=file:/tmp/Test1"

Test suite output:

Test Summary

PASS: cupsd exited with no errors.
PASS: All job control files purged.
PASS: Printer 'Test1' correctly produced 131 page(s).
PASS: Printer 'Test2' correctly produced 23 page(s).
PASS: Printer 'Test3' correctly produced 2 page(s).
PASS: 176 requests logged.
PASS: CUPS-Get-Default not logged.
PASS: 0 emergency messages.
PASS: 0 alert messages.
PASS: 0 critical messages.
PASS: 33 error messages.
grep: /tmp/cups-garstow/log/error_log: binary file matches
FAIL: 4 warning messages, expected 14.
W [12/Jan/2022:11:46:13.686312 +0000] No JobPrivateAccess defined in policy default - using defaults.
W [12/Jan/2022:11:46:13.686315 +0000] No JobPrivateValues defined in policy default - using defaults.
W [12/Jan/2022:11:46:13.686316 +0000] No SubscriptionPrivateAccess defined in policy default - using defaults.
W [12/Jan/2022:11:46:13.686317 +0000] No SubscriptionPrivateValues defined in policy default - using defaults.
grep: /tmp/cups-garstow/log/error_log: binary file matches
grep: /tmp/cups-garstow/log/error_log: binary file matches
PASS: 0 notice messages.
grep: /tmp/cups-garstow/log/error_log: binary file matches
PASS: 137 info messages.
grep: /tmp/cups-garstow/log/error_log: binary file matches
PASS: 4243 debug messages.
grep: /tmp/cups-garstow/log/error_log: binary file matches
PASS: 6135 debug2 messages.
grep: /tmp/cups-garstow/log/error_log: binary file matches

Removing the rip_max_cache code entirely from those two files fixes this for me, but I'm not sure if that's the right fix or if it's intended to contain something...

@michaelrsweet
Copy link
Member

@atsampson We had removed the RIPMaxCache directive from the cupsd.conf file for 2.4.0, but we obviously didn't remove all of the affected code...

[master ee02b74] Remove legacy code for RIP_MAX_CACHE environment variable (Issue #323)

@atsampson
Copy link
Author

It looks like ee02b74 only changes job.c - cupsfilter.c has the same problem...

michaelrsweet added a commit that referenced this issue Jan 12, 2022
@michaelrsweet
Copy link
Member

@atsampson Good catch!

[master 3a1a81d] Also fix cupsfilter (Issue #323)

@atsampson
Copy link
Author

I can confirm that fixes the test suite failure for me - thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-medium
Projects
None yet
Development

No branches or pull requests

2 participants