From 2d9eecc44e92055e1168123e953cbd49145c9cc9 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Mon, 26 Nov 2018 22:27:56 -0500 Subject: [PATCH] Fix a crash bug when mapping PPD duplex options to IPP attributes (rdar://46183976) --- CHANGES.md | 2 ++ cups/ppd-cache.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b794d25c4d..92a40a515f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -47,6 +47,8 @@ Changes in CUPS v2.3b6 - Authentication in the web interface did not work on macOS (rdar://41444473) - Fixed an issue with HTTP Digest authentication (rdar://41709086) - The scheduler could crash when job history was purged (rdar://42198057) +- Fixed a crash bug when mapping PPD duplex options to IPP attributes + (rdar://46183976) - Fixed a memory leak for some IPP (extension) syntaxes. - The `cupscgi`, `cupsmime`, and `cupsppdc` support libraries are no longer installed as shared libraries. diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c index d82961a6d2..9ec6ab07e8 100644 --- a/cups/ppd-cache.c +++ b/cups/ppd-cache.c @@ -292,11 +292,11 @@ _cupsConvertOptions( ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "sides", NULL, keyword); else if (pc->sides_option && (choice = ppdFindMarkedChoice(ppd, pc->sides_option)) != NULL) { - if (!_cups_strcasecmp(choice->choice, pc->sides_1sided)) + if (pc->sides_1sided && !_cups_strcasecmp(choice->choice, pc->sides_1sided)) ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "sides", NULL, "one-sided"); - else if (!_cups_strcasecmp(choice->choice, pc->sides_2sided_long)) + else if (pc->sides_2sided_long && !_cups_strcasecmp(choice->choice, pc->sides_2sided_long)) ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "sides", NULL, "two-sided-long-edge"); - if (!_cups_strcasecmp(choice->choice, pc->sides_2sided_short)) + else if (pc->sides_2sided_short && !_cups_strcasecmp(choice->choice, pc->sides_2sided_short)) ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "sides", NULL, "two-sided-short-edge"); } -- 2.47.2