From fa2ac9450d3c24266c17142b9c597bee7e3ee664 Mon Sep 17 00:00:00 2001 From: Mikolaj Kucharski Date: Thu, 7 May 2020 05:24:35 +0000 Subject: [PATCH] Do not pass NULL to fprintf() 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 | 2 +- filter/rastertopdf.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/filter/gstoraster.c b/filter/gstoraster.c index e78383abc..16b2a9bdf 100644 --- a/filter/gstoraster.c +++ b/filter/gstoraster.c @@ -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 : ""), (outformat == OUTPUT_FORMAT_RASTER ? "CUPS/PWG Raster" : (outformat == OUTPUT_FORMAT_PDF ? "PDF" : "PCL XL"))); diff --git a/filter/rastertopdf.cpp b/filter/rastertopdf.cpp index 76c07da0a..e5c719cea 100644 --- a/filter/rastertopdf.cpp +++ b/filter/rastertopdf.cpp @@ -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 : ""), + (outformat == OUTPUT_FORMAT_PDF ? "PDF" : "PCLM")); num_options = cupsParseOptions(argv[5], 0, &options); -- 2.47.2