]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libppd: In ppdFilterLoadPPD() correct check for final output type
authorTill Kamppeter <till.kamppeter@gmail.com>
Sat, 27 Aug 2022 20:53:45 +0000 (22:53 +0200)
committerTill Kamppeter <till.kamppeter@gmail.com>
Sat, 27 Aug 2022 20:53:45 +0000 (22:53 +0200)
To determine whether the PDF filter (usually cfFilterPDFToPDF()) has
to do the page logging for CUPS ("PAGE: XX YY" log messages) or the
driver filter, we check the final output type (FINAL_CONTENT_TYPE
environment cariable from CUPS) to see whether a driver filter is
involved which should log the pages by itself.

The code to compare the final output type with the "*cupsFilter(2):
..." lines in the PPD file was broken, which is fixed with this
commit.

ppd/ppd-filter.c

index a53af8f8f5660a474503b736eeabab1e53c9e2c8..06a830998ef04f290aad1186fb8bf30226da28a3 100644 (file)
@@ -832,8 +832,10 @@ ppdFilterLoadPPD(cf_filter_data_t *data) /* I/O - Job and printer data */
          while (!isspace(*p)) p ++;
          while (isspace(*p)) p ++;
        }
-       if (!strncasecmp(data->final_content_type, p,
-                        strlen(data->final_content_type))) {
+       if (strlen(p) >= strlen(data->final_content_type) &&
+           !strncasecmp(data->final_content_type, p,
+                        strlen(data->final_content_type)) &&
+           !isalnum(p[strlen(data->final_content_type)])) {
          break;
        }
       }