Rohit Kumar [Wed, 4 Mar 2026 03:47:37 +0000 (09:17 +0530)]
Enhance memory handling in read_jcl_lines
Improve memory management in read_jcl_lines function by using a temporary pointer for realloc and ensuring previously allocated lines are freed on failure.
Introduce foomatic-hash and reject unauthorized values in foomatic-rip (#648)
The change provides a way for users to have control over what values are
allowed for the foomatic-rip-related PPD keywords FoomaticRIPCommandLine,
FoomaticRIPCommandLinePDF, and FoomaticRIPOptionSetting. Since the
values can be later used when constructing a shell command, the filter
foomatic-rip was a target of several exploits (caused by issues at
different places in CUPS or in different projects of the printing stack) to
do arbitrary code execution when the filter is used.
By default the filter is run by user lp, so the issue is mitigated, but
this PR gives admin complete control over what can be run in
foomatic-rip and reject anything injected into system via different
ways.
First, the new tool - foomatic-hash - can be called on a PPD file or
directory with drivers/PPDs, with scan output and file with hexadecimal
representation of hashed values. Once the scan output is reviewed by
admin, admin can decide to put the resulting hashes into
/etc/foomatic/hashes.d and allow them for the filter.
Michael Weghorn [Fri, 5 Jul 2024 11:29:39 +0000 (13:29 +0200)]
pclmtoraster: Properly set CFLAGS (#588)
As this is a C program, set
`pclmtoraster_CFLAGS`, not `pclmtoraster_CXXFLAGS`.
This fixes building pclmtoraster when libcupsfilter
headers are installed in a non-standard directory.
Previously, when configuring and installing libcupsfilters
with e.g. `--prefix=$HOME/temp/cpdb` and then configuring
cups-filters with `PKG_CONFIG_PATH=$HOME/temp/cpdb/lib/pkgconfig/`,
`make pclmtoraster` would fail like this:
CC filter/pclmtoraster.o
filter/pclmtoraster.c:14:10: fatal error: cupsfilters/filter.h: No such file or directory
14 | #include <cupsfilters/filter.h>
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
For this to actually work, recent libcupsfilters
commit [1] is also needed:
Eli Schwartz [Fri, 8 Mar 2024 12:02:33 +0000 (07:02 -0500)]
configure: Fix broken bashism resulting in logic failure (#567)
After carefully using configure checks designed to work on pre-unix wars
bourne shells -- that is, the `test "$var" = ""` construct once upon a
time wasn't specified to treat "" as a distinct argument, and various
buggy implementations mishandled various forms where the first argument
started with a dash, so the "x" padding provided a guaranteed comparison
-- the configure.ac check then fails to run on any shells at all other
than GNU bash.
Bash provides the standard `test XXX = YYY` or `[ XXX = YYY ]`
utilities. It also provides the ability to spell the equals sign as a
double equals. This does nothing whatsoever -- it adds no new
functionality to bash, it forbids nothing, it is *literally* an exact
alias.
It should never be used under any circumstances. All developers must
immediately forget that it exists. Using it is non-portable and does not
work in /bin/sh scripts such as configure scripts, and it results in
dangerous muscle memory when used in bash scripts because it makes
people unthinkingly use the double equals even in /bin/sh scripts. To
add insult to injury, it makes scripts take up more disk space (by a
whole byte! and sometimes even a few bytes...)
Delete this accidental bashism, and restore the ability to get correct
./configure behavior on systems where /bin/sh is something other than a
symlink to GNU bash.
Enable application/vnd.cups-postscript in conversion tables (#534)
Unfortunately there are filters which produce this MIME type (such as
hpps from hplip), and if someone uses such driver on client and server
has IPP Everywhere/driverless driver, job fails.
The patch (together with change in libcupsfilters, which will come later)
fixes the issue.
Till Kamppeter [Wed, 17 May 2023 09:12:37 +0000 (11:12 +0200)]
Merge pull request from GHSA-gpxc-v2m8-fr3x
* beh backend: Use execv() instead of system() - CVE-2023-24805
With execv() command line arguments are passed as separate strings and
not the full command line in a single string. This prevents arbitrary
command execution by escaping the quoting of the arguments in a job
with forged job title.
* beh backend: Extra checks against odd/forged input - CVE-2023-24805
- Do not allow '/' in the scheme of the URI (= backend executable
name), to assure that only backends inside /usr/lib/cups/backend/
are used.
- Pre-define scheme buffer to empty string, to be defined for case of
uri being NULL.
- URI must have ':', to split off scheme, otherwise error.
- Check return value of snprintf() to create call path for backend, to
error out on truncation of a too long scheme or on complete failure
due to a completely odd scheme.
* beh backend: Further improvements - CVE-2023-24805
- Use strncat() instead of strncpy() for getting scheme from URI, the latter
does not require setting terminating zero byte in case of truncation.
- Also exclude "." or ".." as scheme, as directories are not valid CUPS
backends.
- Do not use fprintf() in sigterm_handler(), to not interfere with a
fprintf() which could be running in the main process when
sigterm_handler() is triggered.
- Use "static volatile int" for global variable job_canceled.
Adam Majer [Mon, 10 Apr 2023 14:22:46 +0000 (16:22 +0200)]
Drop C++ references and obsolete C standards (#513)
With no C++ compiler needed, there is no need to set the
CXXFLAGS or log it during configure. Furthermore, forcing
outdated C11 standard is not a good idea considering compilers
have moved on. We should not limit our feature set, including
compiler warnings, to old standards.
Steve Langasek [Fri, 17 Mar 2023 20:02:43 +0000 (13:02 -0700)]
foomatic-rip: Fix a SIGPIPE error when calling gs (#517)
https://autopkgtest.ubuntu.com/packages/f/foo2zjs/lunar/ppc64el shows
foo2zjs's testsuite failing with cups-filters 2.0beta3 on ppc64el because
the gs command here to check page count is failing with a SIGPIPE when
trying to write back to the parent. To fix this, we close gs's input fd as
soon as we know we're done writing to it. Since gs may not have started
processing its input until this happens, also give the final poll() a longer
timeout (5s instead of 1s); without this we see race conditions because
foomatic-rip gives up before gs has had a chance to finish processing.
Till Kamppeter [Wed, 18 Jan 2023 20:48:10 +0000 (17:48 -0300)]
COPYING, NOTICE: Simplification for autotools-generated files
autotools-generated files can be included under the license of the
upstream code, and FSF copyright added to upstream copyright
list. Simplified debian/copyright appropriately.
Till Kamppeter [Tue, 17 Jan 2023 16:53:23 +0000 (13:53 -0300)]
Build system: Do not explicitly check for libpoppler-cpp
The cups-filters does not contain any code using libpoppler-cpp,
therefore we let ./configure not check for it. This makes building
distribution packages easier.
Till Kamppeter [Fri, 6 Jan 2023 19:13:29 +0000 (16:13 -0300)]
README.md: Removed Printer Application links
The package cups-filters only contains classic CUPS filters and
backends, not relevant for Printer Applications, as they would use the
underlying filter functions of libcupsfilters.