From 182b94f58cf9539e832d8ab1c2cc63d8f393e551 Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Mon, 25 Jul 2011 18:04:48 +0200 Subject: [PATCH] Improve the null-pointer.patch (bug #725447). --- gutenprint-null-pointer.patch | 36 ++++++++++++++++++----------------- gutenprint.spec | 5 ++++- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/gutenprint-null-pointer.patch b/gutenprint-null-pointer.patch index 7560c04..2198234 100644 --- a/gutenprint-null-pointer.patch +++ b/gutenprint-null-pointer.patch @@ -1,7 +1,7 @@ diff -up gutenprint-5.2.7/src/escputil/escputil.c.null-pointer gutenprint-5.2.7/src/escputil/escputil.c --- gutenprint-5.2.7/src/escputil/escputil.c.null-pointer 2010-12-11 23:04:07.000000000 +0100 -+++ gutenprint-5.2.7/src/escputil/escputil.c 2011-05-05 13:11:37.000000000 +0200 -@@ -1340,10 +1340,8 @@ do_new_status(status_cmd_t cmd, char *bu ++++ gutenprint-5.2.7/src/escputil/escputil.c 2011-07-25 17:52:56.999202508 +0200 +@@ -1340,10 +1340,14 @@ do_new_status(status_cmd_t cmd, char *bu const char *ind; const stp_string_list_t *color_list = NULL; stp_parameter_t desc; @@ -10,21 +10,23 @@ diff -up gutenprint-5.2.7/src/escputil/escputil.c.null-pointer gutenprint-5.2.7/ - if (desc.p_type == STP_PARAMETER_TYPE_STRING_LIST) - color_list = desc.bounds.str; + const stp_vars_t *printvars = NULL; -+ ++ if (printer) ++ { ++ printvars = stp_printer_get_defaults(printer); ++ stp_describe_parameter(printvars, "ChannelNames", &desc); ++ if (desc.p_type == STP_PARAMETER_TYPE_STRING_LIST) ++ color_list = desc.bounds.str; ++ } STP_DEBUG(printf("New format bytes: %d bytes\n", bytes)); if (cmd == CMD_STATUS) printf(_("Printer Name: %s\n"), -@@ -1409,6 +1407,13 @@ do_new_status(status_cmd_t cmd, char *bu - for (j = 0; j < total_param_count; j++) - { - param = (unsigned) buf[i + j + 2]; -+ if (printer) -+ { -+ printvars = stp_printer_get_defaults(printer); -+ stp_describe_parameter(printvars, "ChannelNames", &desc); -+ if (desc.p_type == STP_PARAMETER_TYPE_STRING_LIST) -+ color_list = desc.bounds.str; -+ } - print_warning(param, color_list); - } - break; +@@ -1428,7 +1432,8 @@ do_new_status(status_cmd_t cmd, char *bu + } + i += total_param_count + 2; + } +- stp_parameter_description_destroy(&desc); ++ if (printer) ++ stp_parameter_description_destroy(&desc); + exit(0); + } + diff --git a/gutenprint.spec b/gutenprint.spec index ece3c78..3e6f4cd 100644 --- a/gutenprint.spec +++ b/gutenprint.spec @@ -4,7 +4,7 @@ Name: gutenprint Summary: Printer Drivers Package Version: 5.2.7 -Release: 3%{?dist} +Release: 4%{?dist} Group: System Environment/Base URL: http://gimp-print.sourceforge.net/ Source0: http://dl.sf.net/gimp-print/gutenprint-5.2/%{version}/gutenprint-%{version}.tar.bz2 @@ -301,6 +301,9 @@ fi /bin/rm -f /var/cache/foomatic/* %changelog +* Mon Jul 25 2011 Jiri Popelka 5.2.7-4 +- Improve the null-pointer.patch (bug #725447). + * Tue Jun 28 2011 Tim Waugh 5.2.7-3 - Fixed use of find_lang macro (bug #716426).