]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: Correct lengths of log message prefixes
authorTill Kamppeter <till.kamppeter@gmail.com>
Fri, 20 May 2022 09:38:40 +0000 (11:38 +0200)
committerTill Kamppeter <till.kamppeter@gmail.com>
Fri, 20 May 2022 09:38:40 +0000 (11:38 +0200)
In the cfFilterExternalCUPS() filter function we catch the stderr
(log) output of the called CUPS filter and convert it into log
function calls with correct log levels. here we need to compare
exactly the prefix, not more and not less, to safely identify the log
level of each line.

This corrects the lengths in the strncmp() calls.

cupsfilters/filter.c

index f51f4bd3a10b1670d1f75b76c177223c7185d95b..99335169736907874deefd4af38c6d4a988dbaef 100644 (file)
@@ -1383,8 +1383,8 @@ cfFilterExternalCUPS(int inputfd,         /* I - File descriptor input stream */
          msg = buf + 7;
        } else if (strncmp(buf, "PAGE: ", 6) == 0 ||
                   strncmp(buf, "ATTR: ", 6) == 0 ||
-                  strncmp(buf, "STATE: ", 6) == 0 ||
-                  strncmp(buf, "PPD: ", 6) == 0) {
+                  strncmp(buf, "STATE: ", 7) == 0 ||
+                  strncmp(buf, "PPD: ", 5) == 0) {
          log_level = CF_LOGLEVEL_CONTROL;
          msg = buf;
        } else {