Hello community,

here is the log from the commit of package cups-filters for openSUSE:Factory 
checked in at 2020-03-08 22:23:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cups-filters (Old)
 and      /work/SRC/openSUSE:Factory/.cups-filters.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cups-filters"

Sun Mar  8 22:23:34 2020 rev:46 rq:781787 version:1.27.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/cups-filters/cups-filters.changes        
2020-02-25 16:01:13.171920594 +0100
+++ /work/SRC/openSUSE:Factory/.cups-filters.new.26092/cups-filters.changes     
2020-03-08 22:23:55.076069336 +0100
@@ -1,0 +2,21 @@
+Thu Mar  5 09:11:09 UTC 2020 - Dmitry Roshchin <dmitr...@opensuse.org>
+
+- Update to 1.27.2
+  * foomatic-rip: In some PostScript input files it was possible
+    that option settings did not get inserted or lines inserted
+    on the wron place (Issue #208, Pull request #210).
+  * foomatic-rip: For the PDF page count call Ghostscript in
+    sandbox mode and fix pointer arithmetics (Pull request
+    #212).
+  * foomatic-rip: Zero-page-job handling changes made the last
+    page of PostScript files not printed, also turning one-page
+    jobs into zero-page jobs (Issue #200, Issue #206, Issue
+    #208, Pull request #209, Pull request #210, Pull request
+    #211).
+    * cups-browsed: check_printer_with_option() function:
+    Initialize the value, add further checks, freeing memory and
+    stop allocating magic numbers (Pull request #204).
+  * cups-browsed: Additional checks against crashes in the
+    is_local_hostname() function (Ubuntu bug #1863716) 
+
+-------------------------------------------------------------------

Old:
----
  cups-filters-1.27.1.tar.xz

New:
----
  cups-filters-1.27.2.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ cups-filters.spec ++++++
--- /var/tmp/diff_new_pack.r3Jf5W/_old  2020-03-08 22:23:55.720069734 +0100
+++ /var/tmp/diff_new_pack.r3Jf5W/_new  2020-03-08 22:23:55.724069736 +0100
@@ -37,7 +37,7 @@
 #       and also run: zypper vcmp 'next version' 'current version'
 # e.g. zypper vcmp '1.0.49' '1.0.49.20140326' -> 1.0.49 is older than 
1.0.49.20140326
 #  and zypper vcmp '1.0.50' '1.0.49.20140326' -> 1.0.50 is newer than 
1.0.49.20140326
-Version:        1.27.1
+Version:        1.27.2
 Release:        0
 Source0:        
http://www.openprinting.org/download/cups-filters/cups-filters-%{version}.tar.xz
 # Upstream fix for https://bugs.linuxfoundation.org/show_bug.cgi?id=1421

++++++ cups-filters-1.27.1.tar.xz -> cups-filters-1.27.2.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cups-filters-1.27.1/INSTALL 
new/cups-filters-1.27.2/INSTALL
--- old/cups-filters-1.27.1/INSTALL     2020-02-16 20:55:06.000000000 +0100
+++ new/cups-filters-1.27.2/INSTALL     2020-02-28 18:48:42.000000000 +0100
@@ -1,4 +1,4 @@
-INSTALL - OpenPrinting CUPS Filters v1.27.1 - 2020-02-16
+INSTALL - OpenPrinting CUPS Filters v1.27.2 - 2020-02-28
 --------------------------------------------------------
 
 This file describes how to compile and install OpenPrinting CUPS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cups-filters-1.27.1/NEWS new/cups-filters-1.27.2/NEWS
--- old/cups-filters-1.27.1/NEWS        2020-02-16 20:55:06.000000000 +0100
+++ new/cups-filters-1.27.2/NEWS        2020-02-28 18:48:42.000000000 +0100
@@ -1,6 +1,25 @@
-NEWS - OpenPrinting CUPS Filters v1.27.1 - 2020-02-16
+NEWS - OpenPrinting CUPS Filters v1.27.2 - 2020-02-28
 -----------------------------------------------------
 
+CHANGES IN V1.27.2
+
+       - foomatic-rip: In some PostScript input files it was possible
+         that option settings did not get inserted or lines inserted
+         on the wron place (Issue #208, Pull request #210).
+       - foomatic-rip: For the PDF page count call Ghostscript in
+         sandbox mode and fix pointer arithmetics (Pull request
+         #212).
+       - foomatic-rip: Zero-page-job handling changes made the last
+         page of PostScript files not printed, also turning one-page
+         jobs into zero-page jobs (Issue #200, Issue #206, Issue
+         #208, Pull request #209, Pull request #210, Pull request
+         #211).
+       - cups-browsed: check_printer_with_option() function:
+         Initialize the value, add further checks, freeing memory and
+         stop allocating magic numbers (Pull request #204).
+       - cups-browsed: Additional checks against crashes in the
+         is_local_hostname() function (Ubuntu bug #1863716)
+
 CHANGES IN V1.27.1
 
        - libcupsfilters: Let the PPD generator not put any dashes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cups-filters-1.27.1/README 
new/cups-filters-1.27.2/README
--- old/cups-filters-1.27.1/README      2020-02-16 20:55:06.000000000 +0100
+++ new/cups-filters-1.27.2/README      2020-02-28 18:48:42.000000000 +0100
@@ -1,4 +1,4 @@
-README - OpenPrinting CUPS Filters v1.27.1 - 2020-02-16
+README - OpenPrinting CUPS Filters v1.27.2 - 2020-02-28
 -------------------------------------------------------
 
 Looking for compile instructions?  Read the file "INSTALL.txt"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cups-filters-1.27.1/configure 
new/cups-filters-1.27.2/configure
--- old/cups-filters-1.27.1/configure   2020-02-16 20:55:19.000000000 +0100
+++ new/cups-filters-1.27.2/configure   2020-02-28 18:48:59.000000000 +0100
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for cups-filters 1.27.1.
+# Generated by GNU Autoconf 2.69 for cups-filters 1.27.2.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@
 # Identity of this package.
 PACKAGE_NAME='cups-filters'
 PACKAGE_TARNAME='cups-filters'
-PACKAGE_VERSION='1.27.1'
-PACKAGE_STRING='cups-filters 1.27.1'
+PACKAGE_VERSION='1.27.2'
+PACKAGE_STRING='cups-filters 1.27.2'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1514,7 +1514,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures cups-filters 1.27.1 to adapt to many kinds of systems.
+\`configure' configures cups-filters 1.27.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1585,7 +1585,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of cups-filters 1.27.1:";;
+     short | recursive ) echo "Configuration of cups-filters 1.27.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1820,7 +1820,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-cups-filters configure 1.27.1
+cups-filters configure 1.27.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2500,7 +2500,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by cups-filters $as_me 1.27.1, which was
+It was created by cups-filters $as_me 1.27.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3536,7 +3536,7 @@
 
 # Define the identity of the package.
  PACKAGE='cups-filters'
- VERSION='1.27.1'
+ VERSION='1.27.2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -24305,7 +24305,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by cups-filters $as_me 1.27.1, which was
+This file was extended by cups-filters $as_me 1.27.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -24371,7 +24371,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-cups-filters config.status 1.27.1
+cups-filters config.status 1.27.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cups-filters-1.27.1/configure.ac 
new/cups-filters-1.27.2/configure.ac
--- old/cups-filters-1.27.1/configure.ac        2020-02-16 20:55:06.000000000 
+0100
+++ new/cups-filters-1.27.2/configure.ac        2020-02-28 18:48:42.000000000 
+0100
@@ -7,7 +7,7 @@
 # ====================
 m4_define([cups_filters_version_major],[1])
 m4_define([cups_filters_version_minor],[27])
-m4_define([cups_filters_version_micro],[1])
+m4_define([cups_filters_version_micro],[2])
 
m4_define([cups_filters_version],[cups_filters_version_major.cups_filters_version_minor.cups_filters_version_micro])
 
 # =============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/cups-filters-1.27.1/filter/foomatic-rip/foomaticrip.c 
new/cups-filters-1.27.2/filter/foomatic-rip/foomaticrip.c
--- old/cups-filters-1.27.1/filter/foomatic-rip/foomaticrip.c   2020-02-16 
20:55:07.000000000 +0100
+++ new/cups-filters-1.27.2/filter/foomatic-rip/foomaticrip.c   2020-02-28 
18:48:43.000000000 +0100
@@ -560,8 +560,10 @@
 {
     FILE *file;
     char buf[8192];
+    char tmpfilename[PATH_MAX];
     int type;
     int startpos;
+    int pagecount;
     size_t n;
     int ret;
 
@@ -603,7 +605,6 @@
                 char pdf2ps_cmd[CMDLINE_MAX];
                 FILE *out, *in;
                 int renderer_pid;
-               char tmpfilename[PATH_MAX] = "";
 
                 _log("Driver does not understand PDF input, "
                      "converting to PostScript\n");
@@ -615,7 +616,7 @@
                 {
                    int fd;
                    FILE *tmpfile;
-                   
+
                    snprintf(tmpfilename, PATH_MAX, "%s/foomatic-XXXXXX", 
temp_dir());
                    fd = mkstemp(tmpfilename);
                    if (fd < 0) {
@@ -625,10 +626,21 @@
                    tmpfile = fdopen(fd, "r+");
                    copy_file(tmpfile, stdin, buf, n);
                    fclose(tmpfile);
-                   
+
                    filename = tmpfilename;
                }
 
+                pagecount = pdf_count_pages(filename);
+                _log("File contains %d pages.\n", pagecount);
+                if (pagecount < 0) {
+                    _log("Unexpected page_count\n");
+                    return 0;
+                }
+                if (pagecount == 0) {
+                  _log("No pages left, outputting empty file.\n");
+                  return 1;
+                }
+
                /* If the spooler is CUPS we use the pdftops filter of CUPS,
                   to have always the same PDF->PostScript conversion method
                   in the whole printing environment, including incompatibility
@@ -668,6 +680,7 @@
                             "Couldn't dup stdout of pdf-to-ps\n");
 
                 clearerr(stdin);
+
                 ret = print_file("<STDIN>", 0);
 
                 wait_for_process(renderer_pid);
@@ -687,7 +700,39 @@
         case PS_FILE:
             _log("Filetype: PostScript\n");
             if (file == stdin)
-                return print_ps(stdin, buf, n, filename);
+            {
+                if (convert)
+                {
+                    int fd;
+                    FILE *tmpfile;
+
+                    snprintf(tmpfilename, PATH_MAX, "%s/foomatic-XXXXXX", 
temp_dir());
+                    fd = mkstemp(tmpfilename);
+                    if (fd < 0) {
+                        _log("Could not create temporary file: %s\n", 
strerror(errno));
+                        return EXIT_PRNERR_NORETRY_BAD_SETTINGS;
+                    }
+
+                    if ((tmpfile = fdopen(fd,"r+")) == 0) {
+                        _log("ERROR: Can't fdopen temporary file\n");
+                        close(fd);
+                        return 0;
+                    }
+
+                    /* Copy stdin to the tmp file */
+                    copy_file(tmpfile, stdin, buf, n);
+                    if (fflush(tmpfile) == EOF)
+                      _log("ERROR: Cannot flush buffer: %s\n", 
strerror(errno));
+                    rewind(tmpfile);
+
+                    ret = print_ps(tmpfile, NULL, 0, tmpfilename);
+                    fclose(tmpfile);
+                    unlink(tmpfilename);
+                    return ret;
+                }
+                else
+                    return print_ps(stdin, buf, n, filename);
+            }
             else
                 return print_ps(file, NULL, 0, filename);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cups-filters-1.27.1/filter/foomatic-rip/pdf.c 
new/cups-filters-1.27.2/filter/foomatic-rip/pdf.c
--- old/cups-filters-1.27.1/filter/foomatic-rip/pdf.c   2020-02-16 
20:55:07.000000000 +0100
+++ new/cups-filters-1.27.2/filter/foomatic-rip/pdf.c   2020-02-28 
18:48:43.000000000 +0100
@@ -39,7 +39,7 @@
 static int wait_for_renderer();
 
 
-static int pdf_count_pages(const char *filename)
+int pdf_count_pages(const char *filename)
 {
     char gscommand[CMDLINE_MAX];
     char output[63] = "";
@@ -47,7 +47,7 @@
     size_t bytes;
     char *p;
 
-    snprintf(gscommand, CMDLINE_MAX, "%s -dNODISPLAY -q -c "
+    snprintf(gscommand, CMDLINE_MAX, "%s -dNODISPLAY -dSAFER -dNOPAUSE -q -c "
             "'/pdffile (%s) (r) file runpdfbegin (PageCount: ) print "
             "pdfpagecount = quit'",
             gspath, filename);
@@ -56,7 +56,7 @@
     if (!pd)
       rip_die(EXIT_STARVED, "Failed to execute ghostscript to determine number 
of input pages!\n");
 
-    bytes = fread_or_die(output, 1, 63, pd);
+    bytes = fread_or_die(output, 1, sizeof(output), pd);
     pclose(pd);
 
     p = output;
@@ -68,7 +68,7 @@
       if (p == NULL)
        break;
       p ++;
-      bytes = output + bytes - p;
+      bytes = sizeof(output) - (p - output);
     }
 
     return pagecount;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cups-filters-1.27.1/filter/foomatic-rip/pdf.h 
new/cups-filters-1.27.2/filter/foomatic-rip/pdf.h
--- old/cups-filters-1.27.1/filter/foomatic-rip/pdf.h   2020-02-16 
20:55:07.000000000 +0100
+++ new/cups-filters-1.27.2/filter/foomatic-rip/pdf.h   2020-02-28 
18:48:43.000000000 +0100
@@ -25,6 +25,7 @@
 #define pdf_h
 
 int print_pdf(FILE *s, const char *alreadyread, size_t len, const char 
*filename, size_t startpos);
+int pdf_count_pages(const char *filename);
 
 #endif
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cups-filters-1.27.1/filter/foomatic-rip/postscript.c 
new/cups-filters-1.27.2/filter/foomatic-rip/postscript.c
--- old/cups-filters-1.27.1/filter/foomatic-rip/postscript.c    2020-02-16 
20:55:07.000000000 +0100
+++ new/cups-filters-1.27.2/filter/foomatic-rip/postscript.c    2020-02-28 
18:48:43.000000000 +0100
@@ -168,17 +168,44 @@
     return cnt;
 }
 
+int ps_pages(const char *filename)
+{
+    char gscommand[65536];
+    char output[31] = "";
+    int pagecount;
+    size_t bytes;
+    snprintf(gscommand, 65536, "%s -q -dNOPAUSE -dBATCH -sDEVICE=bbox %s 2>&1 
| grep -c HiResBoundingBox",
+              CUPS_GHOSTSCRIPT, filename);
+    FILE *pd = popen(gscommand, "r");
+    bytes = fread(output, 1, 31, pd);
+    pclose(pd);
+
+    if (bytes <= 0 || sscanf(output, "%d", &pagecount) < 1)
+        pagecount = -1;
+
+    return pagecount;
+}
+
 int print_ps(FILE *file, const char *alreadyread, size_t len, const char 
*filename)
 {
     stream_t stream;
 
-    if (file != stdin && (dup2(fileno(file), fileno(stdin)) < 0)) {
-        _log("Could not dup %s to stdin.\n", filename);
-        return 0;
+    if (file != stdin)
+    {
+        int pagecount = ps_pages(filename);
+        if (pagecount < 0) {
+            _log("Unexpected page count\n");
+            return 0;
+        }
+        if (pagecount == 0) {
+            _log("No pages left, outputting empty file.\n");
+            return 1;
+        }
+        _log("File contains %d pages.\n", pagecount);
     }
 
     stream.pos = 0;
-    stream.file = stdin;
+    stream.file = file;
     stream.alreadyread = alreadyread;
     stream.len = len;
     _print_ps(&stream);
@@ -322,7 +349,6 @@
     pid_t rendererpid = 0;
     FILE *rendererhandle = NULL;
 
-    int empty = 1;
     int retval;
 
     dstr_t *tmp = create_dstr();
@@ -924,11 +950,11 @@
                                 the beginning of the job or after the last 
valid
                                 section */
                                 dstrclear(tmp);
-                                if (prologfound)
+                                if (!prologfound)
                                     append_prolog_section(tmp, optset, 1);
-                                if (setupfound)
+                                if (!setupfound)
                                     append_setup_section(tmp, optset, 1);
-                                if (pagesetupfound)
+                                if (!pagesetupfound)
                                     append_page_setup_section(tmp, optset, 1);
                                 dstrinsert(psheader, 
line_start(psheader->data, insertoptions), tmp->data);
 
@@ -1010,7 +1036,6 @@
                         /* No renderer running, start it */
                         dstrcpy(tmp, psheader->data);
                         dstrcat(tmp, psfifo->data);
-                        empty = 0;
                         get_renderer_handle(tmp, &rendererhandle, 
&rendererpid);
                         /* psfifo is sent out, flush it */
                         dstrclear(psfifo);
@@ -1075,12 +1100,6 @@
 
     } while ((maxlines == 0 || linect < maxlines) && more_stuff != 0);
 
-    if (empty)
-    {
-        _log("No pages left, outputting empty file.\n");
-        return;
-    }
-
     /* Some buffer still containing data? Send it out to the renderer */
     if (more_stuff || inheader || !isempty(psfifo->data)) {
         /* Flush psfifo and send the remaining data to the renderer, this
@@ -1102,11 +1121,11 @@
             /* If not done yet, insert defaults and command line settings
             in the beginning of the job or after the last valid section */
             dstrclear(tmp);
-            if (prologfound)
+            if (!prologfound)
                 append_prolog_section(tmp, optset, 1);
-            if (setupfound)
+            if (!setupfound)
                 append_setup_section(tmp, optset, 1);
-            if (pagesetupfound)
+            if (!pagesetupfound)
                 append_page_setup_section(tmp, optset, 1);
             dstrinsert(psheader, line_start(psheader->data, insertoptions), 
tmp->data);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cups-filters-1.27.1/ltmain.sh 
new/cups-filters-1.27.2/ltmain.sh
--- old/cups-filters-1.27.1/ltmain.sh   2020-02-16 20:55:14.000000000 +0100
+++ new/cups-filters-1.27.2/ltmain.sh   2020-02-28 18:48:54.000000000 +0100
@@ -31,7 +31,7 @@
 
 PROGRAM=libtool
 PACKAGE=libtool
-VERSION="2.4.6 Debian-2.4.6-12"
+VERSION="2.4.6 Debian-2.4.6-13"
 package_revision=2.4.6
 
 
@@ -2141,7 +2141,7 @@
        compiler:       $LTCC
        compiler flags: $LTCFLAGS
        linker:         $LD (gnu? $with_gnu_ld)
-       version:        $progname $scriptversion Debian-2.4.6-12
+       version:        $progname $scriptversion Debian-2.4.6-13
        automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
        autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cups-filters-1.27.1/utils/cups-browsed.c 
new/cups-filters-1.27.2/utils/cups-browsed.c
--- old/cups-filters-1.27.1/utils/cups-browsed.c        2020-02-16 
20:55:07.000000000 +0100
+++ new/cups-filters-1.27.2/utils/cups-browsed.c        2020-02-28 
18:48:43.000000000 +0100
@@ -2495,18 +2495,35 @@
   remote_printer_t     *p;
   cups_array_t         *first_attributes_value;
   cups_array_t         *second_attributes_value;
-  char                 *borderless_pagesize;
+  char                 *borderless_pagesize = NULL;
   int                  option1_is_size = 0, option2_is_size = 0;
+  unsigned long int    max_length = 0, option1_len = 0, option2_len = 0, t_len 
= 0; 
   char  t[] = ".Borderless";
+  
+  t_len = strlen(t);
+  if (option1)
+    option1_len = strlen(option1);
+  if (option2)
+    option2_len = strlen(option2);
+
+  /* Seems to be possible to have both options...*/
+  max_length = option1_len + option2_len + (2 * t_len) + 1;
+
+  borderless_pagesize = (char *)malloc(sizeof(char) * max_length);
+  if (borderless_pagesize == NULL)
+  {
+    debug_printf("check_printer_with_options: Run out of memory.\n");
+    return 0;
+  }
+  memset(borderless_pagesize, 0, max_length);
 
-  borderless_pagesize = malloc(sizeof(char) * 32);
   if (!strcmp(ppd_keywords[idx_option1], "PageSize") ||
       !strcmp(ppd_keywords[idx_option1], "PageRegion")) {
     /* Check that we are generating .Borderless for the correct size, i.e We
        are generating 4x5.Borderless for 4x5 and not generating 
        4x5.Borderless.Borderless for 4x5.Borderless */
-    if (strlen(option1) >= 11 &&
-       !strcmp(&option1[strlen(option1) - strlen(t)], t))
+    if (option1_len >= 11 &&
+       !strcmp(&option1[option1_len - t_len], t))
       ;
     else {
       strcat(borderless_pagesize, option1);
@@ -2516,8 +2533,8 @@
   }
   if (!strcmp(ppd_keywords[idx_option2], "PageSize") ||
       !strcmp(ppd_keywords[idx_option2], "PageRegion")) {
-    if(strlen(option2) >=11 &&
-       !strcmp(&option2[strlen(option2) - strlen(t)], t))
+    if(option2_len >=11 &&
+       !strcmp(&option2[option2_len - t_len], t))
       ;
     else {
       strcat(borderless_pagesize, option2);
@@ -2540,7 +2557,10 @@
       if (cupsArrayFind(second_attributes_value,(void*)option2) ||
          (option2_is_size && cupsArrayFind(second_attributes_value,
                                            (void*)borderless_pagesize)))
+      {
+        free(borderless_pagesize);
         return 1;
+      }
     }
   }
   free(borderless_pagesize);
@@ -9134,13 +9154,17 @@
 is_local_hostname(const char *host_name) {
   char *host;
 
+  if (host_name == NULL)
+    return 0;
+
   for (host = (char *)cupsArrayFirst (local_hostnames);
        host != NULL;
        host = (char *)cupsArrayNext (local_hostnames))
     if (strncasecmp(host_name, host, strlen(host)) == 0 &&
        (strlen(host_name) == strlen(host) ||
-        strcasecmp(host_name + strlen(host), ".local") == 0 ||
-        strcasecmp(host_name + strlen(host), ".local.") == 0))
+        (strlen(host_name) > strlen(host) &&
+         (strcasecmp(host_name + strlen(host), ".local") == 0 ||
+          strcasecmp(host_name + strlen(host), ".local.") == 0))))
       return 1;
 
   return 0;
@@ -9766,7 +9790,8 @@
     strncpy(ifname, "Unknown", sizeof(ifname) - 1);
   }
 
-  /* Ignore local queues on the port of the cupsd we are serving for */
+  /* Ignore local queues of the cupsd we are serving for, identifying them
+     via UUID */
   update_netifs(NULL);
   if ((flags & AVAHI_LOOKUP_RESULT_LOCAL) || !strcasecmp(ifname, "lo") ||
       is_local_hostname(host_name)) {


Reply via email to