]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
For octetString values, compare the length against the -supported value
authorMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 15 Apr 2019 20:28:06 +0000 (16:28 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 15 Apr 2019 20:28:06 +0000 (16:28 -0400)
(Issue #5557)

CHANGES.md
cups/dest-options.c

index 59ce9484bbea00193c8cc329f7e1cb396bfeceaa..60f50f78e2ce69f591819b711cdc983fd1876116 100644 (file)
@@ -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)
 
index 51705a50cb5e5744deec04a8443bfd9f42fb6b97..cddc2f9550d0b17c02d972a724b9eb68a9e482fb 100644 (file)
@@ -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
@@ -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 */
 
 
  /*
@@ -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);
 
@@ -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 &&