Skip to content

Commit d19fd2e

Browse files
committed
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.
1 parent ae48009 commit d19fd2e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

backend/ipp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2984,7 +2984,7 @@ new_request(
29842984
fputs("DEBUG: Adding all operation/job attributes.\n", stderr);
29852985
adjust_options(num_options, options);
29862986

2987-
if (!strcmp(format, "image/pwg-raster") || !strcmp(format, "image/urf"))
2987+
if (format && (!strcmp(format, "image/pwg-raster") || !strcmp(format, "image/urf")))
29882988
num_options = cupsRemoveOption("copies", num_options, &options);
29892989

29902990
cupsEncodeOptions2(request, num_options, options, IPP_TAG_OPERATION);

0 commit comments

Comments
 (0)