net-print/cups-browsed: backport 2 crash fixes to 2.1.1

Also, drop workaround added for bug #940311, as it's resolved upstream
in 2.1.1.

Bug: https://bugs.gentoo.org/940311
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James 2025-04-25 01:35:48 +01:00
parent 6e29bbcd3a
commit c7112c5d9b
No known key found for this signature in database
GPG Key ID: 738409F520DF9190
3 changed files with 78 additions and 2 deletions

View File

@ -40,11 +40,14 @@ BDEPEND="
# successfully running the tests, restrict it.
RESTRICT="test"
PATCHES=(
"${FILESDIR}"/${P}-no-model.patch
"${FILESDIR}"/${P}-crash.patch
)
src_configure() {
local myeconfargs=(
--localstatedir="${EPREFIX}"/var
# Omit cups here for bug #940311 (CVE-2024-47176 mitigation)
--with-browseremoteprotocols=dnssd
--with-cups-rundir="${EPREFIX}"/run/cups
--with-rcdir=no

View File

@ -0,0 +1,31 @@
https://github.com/OpenPrinting/cups-browsed/commit/724ac36fd2cd9c11f7c429b63ba1e9e7fed0d326
From 724ac36fd2cd9c11f7c429b63ba1e9e7fed0d326 Mon Sep 17 00:00:00 2001
From: Till Kamppeter <till.kamppeter@gmail.com>
Date: Wed, 16 Apr 2025 18:59:34 +0200
Subject: [PATCH] cups-browsed: NULL check od make/model string when checking
printer's PDLs
If we allow setting up queues for non-driverless legacy IPP printers
(IPP 1.x) we check for known PDLs and here we check also the
make/model string, but our check would crash cups-browsed if the
string is NULL. This commit adds an appropriate NULL check.
---
daemon/cups-browsed.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/daemon/cups-browsed.c b/daemon/cups-browsed.c
index 46bc8892..ad4e4f45 100644
--- a/daemon/cups-browsed.c
+++ b/daemon/cups-browsed.c
@@ -6832,7 +6832,8 @@ create_remote_printer_entry (const char *queue_name,
((!strcasestr(pdl, "application/vnd.hp-PCL") &&
!strcasestr(pdl, "application/PCL") &&
!strcasestr(pdl, "application/x-pcl")) ||
- ((!strncasecmp(make_model, "HP", 2) || // HP inkjets not supported
+ (make_model &&
+ (!strncasecmp(make_model, "HP", 2) || // HP inkjets not supported
!strncasecmp(make_model, "Hewlett Packard", 15) ||
!strncasecmp(make_model, "Hewlett-Packard", 15)) &&
!strcasestr(make_model, "LaserJet") &&

View File

@ -0,0 +1,42 @@
https://github.com/OpenPrinting/cups-browsed/commit/6f48f9daf91fff0c94abe3325b583eb959b480c2
From 6f48f9daf91fff0c94abe3325b583eb959b480c2 Mon Sep 17 00:00:00 2001
From: Till Kamppeter <till.kamppeter@gmail.com>
Date: Wed, 16 Apr 2025 17:41:24 +0200
Subject: [PATCH] cups-browsed: Generate PPD for printer also if it does not
report make/model
It can happen that an IPP printer does not report make and model in
its DNS-SD record. cups-browsed did not create a PPD file for the
local queue then. This commit fixes it.
The ppdCreatePPDFromIPP2() function of libppd works also when its
make_model parameter is NULL.
---
daemon/cups-browsed.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/daemon/cups-browsed.c b/daemon/cups-browsed.c
index 5401a134..42cebf3c 100644
--- a/daemon/cups-browsed.c
+++ b/daemon/cups-browsed.c
@@ -7582,7 +7582,8 @@ create_queue(void* arg)
debug_printf("Generated Default Attributes for local queue %s\n",
p->queue_name);
}
- if (ppdfile == NULL && make_model && strcmp(make_model, "Local Raw Printer"))
+ if (ppdfile == NULL &&
+ (!make_model || strcmp(make_model, "Local Raw Printer")))
{
// If we do not want CUPS-generated PPDs or we cannot obtain a
// CUPS-generated PPD, for example if CUPS does not create a
@@ -7775,7 +7776,8 @@ create_queue(void* arg)
debug_printf("Generated Default Attributes for local queue %s\n",
p->queue_name);
}
- if (ppdfile == NULL && make_model && strcmp(make_model, "Local Raw Printer"))
+ if (ppdfile == NULL &&
+ (!make_model || strcmp(make_model, "Local Raw Printer")))
{
// If we do not want CUPS-generated PPDs or we cannot obtain a
// CUPS-generated PPD, for example if CUPS does not create a