2150035 - [abrt] cups-filters: __strlen_avx2(): cups-browsed killed by SIGSEGV

This commit is contained in:
Zdenek Dohnal 2023-08-29 16:06:48 +02:00
parent 66344108f8
commit 52d6a5dd01
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From 93285f8bb16bd9fe8e1877999c601346c4c341dc Mon Sep 17 00:00:00 2001
From: zdohnal <zdohnal@redhat.com>
Date: Tue, 29 Aug 2023 12:06:17 +0200
Subject: [PATCH] cups-browsed.c: Ensure we always send a valid name to
`remove_bad_chars` (#13)
Fixes Fedora bugzilla #2150035 - in case the found queue is CUPS remote
queue shared via DNS-SD, `rp_value` can be without '/', which leads to
`cups-browsed` crash if it is set to create the local queue based on
remote name.
---
daemon/cups-browsed.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/daemon/cups-browsed.c b/daemon/cups-browsed.c
index 626473b7..b06461b4 100644
--- a/daemon/cups-browsed.c
+++ b/daemon/cups-browsed.c
@@ -6185,10 +6185,18 @@ get_local_queue_name(const char *service_name,
// make/model info
queue_name = remove_bad_chars(make_model, 0);
else if (LocalQueueNamingRemoteCUPS == LOCAL_QUEUE_NAMING_REMOTE_NAME)
+ {
// Not directly used in script generation input later, but taken from
// packet, so better safe than sorry. (consider second loop with
// backup_queue_name)
- queue_name = remove_bad_chars(strrchr(resource, '/') + 1, 0);
+
+ /* We can get resource without / or without string after / - use
+ * the original string (possible trailing / will be removed) */
+ if ((str = strrchr(resource, '/')) == NULL || strlen(str) <= 1)
+ str = resource;
+
+ queue_name = remove_bad_chars(str, 0);
+ }
else
// Convert DNS-SD service name into a CUPS queue name exactly
// as CUPS would do it, to override CUPS' own temporary queue
--
2.41.0

View File

@ -12,7 +12,7 @@
Name: cups-browsed
Epoch: 1
Version: 2.0~rc2
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Daemon for local auto-installation of remote printers
# the CUPS exception text is the same as LLVM exception, so using that name with
# agreement from legal team
@ -23,6 +23,7 @@ Source0: %{URL}/releases/download/%{upstream_version}/%{name}-%{upstream_version
# Patches
Patch001: 0001-cups-browsed.c-Ensure-we-always-send-a-valid-name-to.patch
# remove once CentOS Stream 10 is released, cups-browsed
@ -176,6 +177,9 @@ done
%changelog
* Tue Aug 29 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.0~rc2-3
- 2150035 - [abrt] cups-filters: __strlen_avx2(): cups-browsed killed by SIGSEGV
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0~rc2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild