From 1fc0a67de9a465fdc9daa67e4f54b6044c384da4 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Fri, 20 Mar 2020 06:37:18 +0100 Subject: [PATCH] fix leaks in cups-browsed add require on nss-mdns --- cups-browsed-leaks.patch | 95 ++++++++++++++++++++++++++++++++++++++++ cups-filters.spec | 12 ++++- 2 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 cups-browsed-leaks.patch diff --git a/cups-browsed-leaks.patch b/cups-browsed-leaks.patch new file mode 100644 index 0000000..e283cbb --- /dev/null +++ b/cups-browsed-leaks.patch @@ -0,0 +1,95 @@ +diff --git a/utils/cups-browsed.c b/utils/cups-browsed.c +index 77efa583..dd0fcbb3 100644 +--- a/utils/cups-browsed.c ++++ b/utils/cups-browsed.c +@@ -6278,6 +6278,7 @@ on_job_state (CupsNotifier *object, + } + + ippDelete(response); ++ response = NULL; + } else + debug_printf("IPP request to %s:%d failed.\n", p->host, + p->port); +@@ -8070,7 +8071,7 @@ gboolean update_cups_queues(gpointer unused) { + debug_printf("Default page size: %s\n", + default_page_size); + p->num_options = cupsAddOption("media-default", +- strdup(default_page_size), ++ default_page_size, + p->num_options, &(p->options)); + } else { + attr = ippFindAttribute(p->prattrs, +@@ -8081,7 +8082,7 @@ gboolean update_cups_queues(gpointer unused) { + debug_printf("Default page size: %s\n", + default_page_size); + p->num_options = cupsAddOption("media-default", +- strdup(default_page_size), ++ default_page_size, + p->num_options, &(p->options)); + } else + debug_printf("No default page size found!\n"); +@@ -8101,7 +8102,7 @@ gboolean update_cups_queues(gpointer unused) { + bottom = 1270; + snprintf(buffer, sizeof(buffer), "%d", bottom); + p->num_options = cupsAddOption("media-bottom-margin-default", +- strdup(buffer), ++ buffer, + p->num_options, &(p->options)); + + if ((attr = ippFindAttribute(p->prattrs, +@@ -8117,7 +8118,7 @@ gboolean update_cups_queues(gpointer unused) { + left = 635; + snprintf(buffer, sizeof(buffer), "%d", left); + p->num_options = cupsAddOption("media-left-margin-default", +- strdup(buffer), ++ buffer, + p->num_options, &(p->options)); + + if ((attr = ippFindAttribute(p->prattrs, +@@ -8133,7 +8134,7 @@ gboolean update_cups_queues(gpointer unused) { + right = 635; + snprintf(buffer, sizeof(buffer), "%d", right); + p->num_options = cupsAddOption("media-right-margin-default", +- strdup(buffer), ++ buffer, + p->num_options, &(p->options)); + + if ((attr = ippFindAttribute(p->prattrs, +@@ -8149,7 +8150,7 @@ gboolean update_cups_queues(gpointer unused) { + top = 1270; + snprintf(buffer, sizeof(buffer), "%d", top); + p->num_options = cupsAddOption("media-top-margin-default", +- strdup(buffer), ++ buffer, + p->num_options, &(p->options)); + + debug_printf("Margins: Left: %d, Right: %d, Top: %d, Bottom: %d\n", +@@ -8170,7 +8171,7 @@ gboolean update_cups_queues(gpointer unused) { + debug_printf("Best color space: %s\n", + best_color_space); + p->num_options = cupsAddOption("print-color-mode-default", +- strdup(best_color_space), ++ best_color_space, + p->num_options, &(p->options)); + } else { + debug_printf("No info about supported color spaces found!\n"); +@@ -8185,7 +8186,7 @@ gboolean update_cups_queues(gpointer unused) { + p->num_options, &(p->options)); + + p->num_options = cupsAddOption("output-format-default", +- strdup(p->pdl), ++ p->pdl, + p->num_options, &(p->options)); + p->num_options = cupsAddOption("make-and-model-default", + remove_bad_chars(p->make_model, 0), +@@ -8527,8 +8528,8 @@ gboolean update_cups_queues(gpointer unused) { + /* Default option settings from printer entry */ + for (i = 0; i < p->num_options; i ++) + if (strcasecmp(p->options[i].name, "printer-is-shared")) +- num_options = cupsAddOption(strdup(p->options[i].name), +- strdup(p->options[i].value), ++ num_options = cupsAddOption(p->options[i].name, ++ p->options[i].value, + num_options, &options); + /* Encode option list into IPP attributes */ + cupsEncodeOptions2(request, num_options, options, IPP_TAG_OPERATION); diff --git a/cups-filters.spec b/cups-filters.spec index f3f0b74..7b3264a 100644 --- a/cups-filters.spec +++ b/cups-filters.spec @@ -4,7 +4,7 @@ Summary: OpenPrinting CUPS filters and backends Name: cups-filters Version: 1.27.2 -Release: 1%{?dist} +Release: 2%{?dist} # For a breakdown of the licensing, see COPYING file # GPLv2: filters: commandto*, imagetoraster, pdftops, rasterto*, @@ -30,6 +30,7 @@ Patch02: cups-browsed.8.patch # Segfaults in test suite when test font is missing # https://github.com/OpenPrinting/cups-filters/pull/214 Patch03: 0001-Fix-segfaults-in-test-suite-when-test-font-is-missin.patch +Patch04: cups-browsed-leaks.patch Requires: cups-filters-libs%{?_isa} = %{version}-%{release} @@ -109,6 +110,10 @@ Requires(post): systemd Requires(preun): systemd Requires(postun): systemd +# cups-browsed needs nss-mdns for resolving .local addresses of remote print queues +# or device during discovery +Requires: nss-mdns + %package libs Summary: OpenPrinting CUPS filters and backends - cupsfilters and fontembed libraries # LGPLv2: libcupsfilters @@ -141,6 +146,7 @@ This is the development package for OpenPrinting CUPS filters and backends. # links in manpage %patch02 -p1 -b .manpage %patch03 -p1 -b .fontemb +%patch04 -p1 -b .memleaks %build # work-around Rpath @@ -307,6 +313,10 @@ done %{_libdir}/libfontembed.so %changelog +* Fri Mar 13 2020 Zdenek Dohnal - 1.27.2-2 +- fix leaks in cups-browsed +- add require on nss-mdns + * Mon Mar 02 2020 Zdenek Dohnal - 1.27.2-1 - 1.27.2