]> 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:26:46 +0000 (16:26 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 15 Apr 2019 20:26:46 +0000 (16:26 -0400)
(Issue #5557)

CHANGES.md
cups/dest-options.c

index 4e4e715e639eb9abd1a7b7c3554134442cbd359f..4cc5795c83aa3386a2ea1f31ed7c179b0f382656 100644 (file)
@@ -11,6 +11,8 @@ Changes in CUPS v2.3b8
 - Fixed a performance regression with large PPDs (rdar://47040759)
 - The scheduler did not encode octetString values like "job-password" correctly
   for the print filters (Issue #5558)
+- The `cupsCheckDestSupported` function did not check octetString values
+  correctly (Issue #5557)
 - Updated the systemd service file for cupsd (Issue #5551)
 - The `ippValidateAttribute` function did not catch all instances of invalid
   UTF-8 strings (Issue #5509)
index 308ee33597cb0d6ae7881d29281f547d8108dd15..ee7bb83b7d901db90edc3cca6f254c1fdc503f94 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Destination option/media support for CUPS.
  *
- * Copyright © 2012-2018 by Apple Inc.
+ * Copyright © 2012-2019 by Apple Inc.
  *
  * Licensed under Apache License v2.0.  See the file "LICENSE" for more
  * information.
@@ -179,6 +179,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 */
 
 
  /*
@@ -270,9 +271,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);
 
@@ -285,7 +291,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 &&