From: Zdenek Dohnal Date: Fri, 14 Mar 2025 06:42:25 +0000 (+0100) Subject: Avoid NULL strcmp argument X-Git-Tag: v2.4.12~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d19fd2e2c317eb9958be338ddc49dc34e472cae1;p=thirdparty%2Fcups.git Avoid NULL strcmp argument It is possible for format to be NULL (as described in the function signature) which causes a segmentation fault when it is passed to strcmp. This patch changes the conditional to short-circuit if format is NULL and only call strcmp otherwise. --- diff --git a/backend/ipp.c b/backend/ipp.c index 6888eff5c5..80f5d12581 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -2984,7 +2984,7 @@ new_request( fputs("DEBUG: Adding all operation/job attributes.\n", stderr); adjust_options(num_options, options); - if (!strcmp(format, "image/pwg-raster") || !strcmp(format, "image/urf")) + if (format && (!strcmp(format, "image/pwg-raster") || !strcmp(format, "image/urf"))) num_options = cupsRemoveOption("copies", num_options, &options); cupsEncodeOptions2(request, num_options, options, IPP_TAG_OPERATION);