From eabdf636ce3041a7664b5f3d28934efe17c39711 Mon Sep 17 00:00:00 2001 From: Erik <76848161+ErikUmble@users.noreply.github.com> Date: Wed, 12 Mar 2025 23:44:39 -0400 Subject: [PATCH] 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. --- backend/ipp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.47.2