From 21df78564ad6e874fa595d602a772e12dc6e26fc Mon Sep 17 00:00:00 2001 From: Richard Lescak Date: Jan 13 2022 10:56:47 +0000 Subject: Fix memory leaks in http_tls_upgrade() and _cupsEncodeOption() --- diff --git a/0001-cups-http-encode-memleaks-fixes-issue-322.patch b/0001-cups-http-encode-memleaks-fixes-issue-322.patch new file mode 100644 index 0000000..be7e2a3 --- /dev/null +++ b/0001-cups-http-encode-memleaks-fixes-issue-322.patch @@ -0,0 +1,38 @@ +From d9924186325c89aefa56e36258f56f246dd2c4ad Mon Sep 17 00:00:00 2001 +From: Richard Lescak +Date: Tue, 11 Jan 2022 10:53:34 +0100 +Subject: [PATCH] cups/http.c,encode.c: Fix memory leaks + +--- + CHANGES.md | 3 ++- + cups/encode.c | 1 + + cups/http.c | 1 + + 3 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/cups/encode.c b/cups/encode.c +index 5bcbf6fe5..15b1c6b40 100644 +--- a/cups/encode.c ++++ b/cups/encode.c +@@ -655,6 +655,7 @@ _cupsEncodeOption( + ippSetCollection(ipp, &attr, i, collection); + cupsEncodeOptions2(collection, num_cols, cols, IPP_TAG_JOB); + cupsFreeOptions(num_cols, cols); ++ ippDelete(collection); + break; + + default : +diff --git a/cups/http.c b/cups/http.c +index bd41e6f8e..4b6a24bd3 100644 +--- a/cups/http.c ++++ b/cups/http.c +@@ -4624,6 +4624,7 @@ http_tls_upgrade(http_t *http) /* I - HTTP connection */ + * Restore the HTTP request data... + */ + ++ httpClearFields(http); + memcpy(http->_fields, myhttp._fields, sizeof(http->_fields)); + memcpy(http->fields, myhttp.fields, sizeof(http->fields)); + +-- +2.31.1 + diff --git a/cups.spec b/cups.spec index c9f8527..d6e3daa 100644 --- a/cups.spec +++ b/cups.spec @@ -17,7 +17,7 @@ Summary: CUPS printing system Name: cups Epoch: 1 Version: 2.3.3%{OP_VER} -Release: 11%{?dist} +Release: 12%{?dist} License: ASL 2.0 Url: https://openprinting.github.io/cups/ # Apple stopped uploading the new versions into github, use OpenPrinting fork @@ -103,6 +103,9 @@ Patch26: 0001-cups-http-support.c-Apply-DigestOptions-to-RFC-2069-.patch Patch27: 0001-Add-with-idle-exit-timeout-configure-option.patch # 2018953 - RFE: Implement TimeoutStartSec configuration during build Patch28: 0001-Add-with-systemd-timeoutstartsec-configure-option.patch +# Memory leak fixes +# https://github.com/OpenPrinting/cups/pull/322 +Patch29: 0001-cups-http-encode-memleaks-fixes-issue-322.patch ##### Patches removed because IMHO they aren't no longer needed ##### but still I'll leave them in git in case their removal @@ -334,6 +337,8 @@ to CUPS daemon. This solution will substitute printer drivers and raw queues in %patch27 -p1 -b .conf-idleexittimeout # 2018953 - RFE: Implement TimeoutStartSec configuration during build %patch28 -p1 -b .conf-timeoutstartsec +# Memory leak fixes +%patch29 -p1 -b .memleak-fixes %if %{lspp} @@ -710,6 +715,9 @@ rm -f %{cups_serverbin}/backend/smb %{_mandir}/man7/ippeveps.7.gz %changelog +* Wed Jan 12 2022 Richard Lescak - 1:2.3.3op2-12 +- Fix memory leaks in http_tls_upgrade() and _cupsEncodeOption() + * Mon Nov 29 2021 Zdenek Dohnal - 1:2.3.3op2-11 - 2018957 - RFE: Implement IdleExitTimeout configuration during build - 2018953 - RFE: Implement TimeoutStartSec configuration during build