]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/encode.c
Import CUPS 1.4svn-r7226.
[thirdparty/cups.git] / cups / encode.c
index 4e7f78118548ba342a3ab0d5c096bf702c0661de..9ac62b870d99dd23f061704f45bba046041a406f 100644 (file)
@@ -396,10 +396,44 @@ cupsEncodeOptions2(
       * Find the end of this value and mark it if needed...
       */
 
-      if ((sep = strchr(val, ',')) != NULL)
+      for (sep = val; *sep; sep ++)
+      {
+       if (*sep == '\'')
+       {
+        /*
+         * Skip quoted option value...
+         */
+
+         sep ++;
+
+         while (*sep && *sep != '\'')
+           sep ++;
+
+         if (!*sep)
+           sep --;
+       }
+       else if (*sep == '\"')
+       {
+        /*
+         * Skip quoted option value...
+         */
+
+         sep ++;
+
+         while (*sep && *sep != '\"')
+           sep ++;
+
+         if (!*sep)
+           sep --;
+       }
+       else if (*sep == ',')
+         break;
+       else if (*sep == '\\' && sep[1])
+         sep ++;
+      }
+
+      if (*sep == ',')
        *sep++ = '\0';
-      else
-       sep = val + strlen(val);
 
      /*
       * Copy the option value(s) over as needed by the type...