Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

Commit 0ad7895

Browse files
committed
For octetString values, compare the length against the -supported value
(Issue #5557)
1 parent aaebca5 commit 0ad7895

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Changes in CUPS v2.2.12
66
-----------------------
77

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

cups/dest-options.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Destination option/media support for CUPS.
33
*
4-
* Copyright 2012-2017 by Apple Inc.
4+
* Copyright 2012-2019 by Apple Inc.
55
*
66
* These coded instructions, statements, and computer programs are the
77
* property of Apple Inc. and are protected by Federal copyright
@@ -83,6 +83,7 @@ cupsCheckDestSupported(
8383
ipp_res_t units_value; /* Resolution units */
8484
ipp_attribute_t *attr; /* Attribute */
8585
_ipp_value_t *attrval; /* Current attribute value */
86+
_ipp_option_t *map; /* Option mapping information */
8687

8788

8889
/*
@@ -174,9 +175,14 @@ cupsCheckDestSupported(
174175
* Check literal values...
175176
*/
176177

178+
map = _ippFindOption(option);
179+
177180
switch (attr->value_tag)
178181
{
179182
case IPP_TAG_INTEGER :
183+
if (map && map->value_tag == IPP_TAG_STRING)
184+
return (strlen(value) <= (size_t)attr->values[0].integer);
185+
180186
case IPP_TAG_ENUM :
181187
int_value = atoi(value);
182188

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

191197
case IPP_TAG_RANGE :
192-
int_value = atoi(value);
198+
if (map && map->value_tag == IPP_TAG_STRING)
199+
int_value = (int)strlen(value);
200+
else
201+
int_value = atoi(value);
193202

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

0 commit comments

Comments
 (0)