Skip to content

Commit

Permalink
For octetString values, compare the length against the -supported value
Browse files Browse the repository at this point in the history
(Issue #5557)
  • Loading branch information
michaelrsweet committed Apr 15, 2019
1 parent aaebca5 commit 0ad7895
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Changes in CUPS v2.2.12
-----------------------

- Updated the systemd service file for cupsd (Issue #5551)
- The `cupsCheckDestSupported` function did not check octetString values
correctly (Issue #5557)
- The scheduler did not encode octetString values like "job-password" correctly
for the print filters (Issue #5558)

Expand Down
13 changes: 11 additions & 2 deletions cups/dest-options.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Destination option/media support for CUPS.
*
* Copyright 2012-2017 by Apple Inc.
* Copyright 2012-2019 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
Expand Down Expand Up @@ -83,6 +83,7 @@ cupsCheckDestSupported(
ipp_res_t units_value; /* Resolution units */
ipp_attribute_t *attr; /* Attribute */
_ipp_value_t *attrval; /* Current attribute value */
_ipp_option_t *map; /* Option mapping information */


/*
Expand Down Expand Up @@ -174,9 +175,14 @@ cupsCheckDestSupported(
* Check literal values...
*/

map = _ippFindOption(option);

switch (attr->value_tag)
{
case IPP_TAG_INTEGER :
if (map && map->value_tag == IPP_TAG_STRING)
return (strlen(value) <= (size_t)attr->values[0].integer);

case IPP_TAG_ENUM :
int_value = atoi(value);

Expand All @@ -189,7 +195,10 @@ cupsCheckDestSupported(
return (attr->values[0].boolean);

case IPP_TAG_RANGE :
int_value = atoi(value);
if (map && map->value_tag == IPP_TAG_STRING)
int_value = (int)strlen(value);
else
int_value = atoi(value);

for (i = 0; i < attr->num_values; i ++)
if (int_value >= attr->values[i].range.lower &&
Expand Down

0 comments on commit 0ad7895

Please sign in to comment.