]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Delete enum attribute if the value is bad.
authorMichael R Sweet <msweet@msweet.org>
Fri, 5 Apr 2024 21:03:32 +0000 (17:03 -0400)
committerMichael R Sweet <msweet@msweet.org>
Fri, 5 Apr 2024 21:03:32 +0000 (17:03 -0400)
cups/encode.c

index 703cfe854dc2077c386194d0ea667c923e21cee1..7bd41a9089990f0641ed7fb3a1f5a777d836de44 100644 (file)
@@ -550,7 +550,17 @@ _cupsEncodeOption(
           if (isalpha(*val & 255))
           {
             // Map enum keyword to integer value...
-            ippSetInteger(ipp, &attr, i, ippEnumValue(name, val));
+            int enumvalue;             // Enumeration value
+
+            if ((enumvalue = ippEnumValue(name, val)) > 0)
+            {
+              ippSetInteger(ipp, &attr, i, enumvalue);
+           }
+           else
+           {
+             ippDeleteAttribute(ipp, attr);
+             return (NULL);
+           }
             break;
          }