From: Erik <76848161+ErikUmble@users.noreply.github.com> Date: Thu, 13 Mar 2025 03:44:39 +0000 (-0400) Subject: Avoid NULL strcmp argument X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1197%2Fhead;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 7b9f9496a1..ab4eaa75c9 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -2960,7 +2960,7 @@ new_request( fputs("DEBUG: Adding all operation/job attributes.\n", stderr); num_options = 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);