]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Avoid NULL strcmp argument 1197/head
authorErik <76848161+ErikUmble@users.noreply.github.com>
Thu, 13 Mar 2025 03:44:39 +0000 (23:44 -0400)
committerGitHub <noreply@github.com>
Thu, 13 Mar 2025 03:44:39 +0000 (23:44 -0400)
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

index 7b9f9496a178633605d13361fd5b926fafc3963a..ab4eaa75c99d7a0c27a40ce5debb3cd244b359c2 100644 (file)
@@ -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);