]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
Do not pass NULL to fprintf() 230/head
authorMikolaj Kucharski <mikolaj@kucharski.name>
Thu, 7 May 2020 05:24:35 +0000 (05:24 +0000)
committerMikolaj Kucharski <mikolaj@kucharski.name>
Thu, 7 May 2020 05:24:35 +0000 (05:24 +0000)
Passing NULL to printf-family of functions is undefined
behaviour. OpenBSD has detection mechanism for occurrences
of such condition. On my machine I get following messages
in syslog, while printing:

vfprintf %s NULL in "DEBUG: OUTFORMAT="%s", so output format will be %s "

Changes in this diff make those messages go away.

filter/gstoraster.c
filter/rastertopdf.cpp

index e78383abc9eb5c044ebff830c3d39ec8a8b918d6..16b2a9bdff5809abc0d389d8280020a1011727df 100644 (file)
@@ -639,7 +639,7 @@ main (int argc, char **argv, char *envp[])
     goto out;
   }
   fprintf(stderr, "DEBUG: OUTFORMAT=\"%s\", so output format will be %s\n",
-         outformat_env,
+         (outformat_env ? outformat_env : "<none>"),
          (outformat == OUTPUT_FORMAT_RASTER ? "CUPS/PWG Raster" :
           (outformat == OUTPUT_FORMAT_PDF ? "PDF" :
            "PCL XL")));
index 76c07da0afcee817ea2c19a451dc378b08170e45..e5c719ceae0c2817032029a2e68bab4c272c641f 100644 (file)
@@ -1343,7 +1343,8 @@ int main(int argc, char **argv)
     outformat = OUTPUT_FORMAT_PDF;
 #endif
     fprintf(stderr, "DEBUG: OUTFORMAT=\"%s\", output format will be %s\n",
-           outformat_env, (outformat == OUTPUT_FORMAT_PDF ? "PDF" : "PCLM"));
+           (outformat_env ? outformat_env : "<none>"),
+           (outformat == OUTPUT_FORMAT_PDF ? "PDF" : "PCLM"));
   
     num_options = cupsParseOptions(argv[5], 0, &options);