Fixes for BOOL handling: produce errors for invalid string for mini-compiler,
authorDr. Stephen Henson <steve@openssl.org>
Thu, 19 Jan 2006 17:17:33 +0000 (17:17 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 19 Jan 2006 17:17:33 +0000 (17:17 +0000)
correctly encode FALSE for BOOL in ASN1_TYPE.

crypto/asn1/asn1_gen.c
crypto/asn1/tasn_enc.c

index e6e04a1cd73ce89e1c73b71ade2da31b665d965e..26c832781e40c0ff05557b19803e8e33dbdbbffa 100644 (file)
@@ -658,6 +658,8 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype)
                        ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_NOT_ASCII_FORMAT);
                        goto bad_form;
                        }
+               vtmp.name = NULL;
+               vtmp.section = NULL;
                vtmp.value = (char *)str;
                if (!X509V3_get_value_bool(&vtmp, &atmp->value.boolean))
                        {
index 0f950db244ca112e69c3ca29f3211ad412601783..25c94aa1d95a078c3db63a94ad793cc040d0b128 100644 (file)
@@ -618,11 +618,14 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
                tbool = (ASN1_BOOLEAN *)pval;
                if (*tbool == -1)
                        return -1;
-               /* Default handling if value == size field then omit */
-               if (*tbool && (it->size > 0))
-                       return -1;
-               if (!*tbool && !it->size)
-                       return -1;
+               if (it->utype != V_ASN1_ANY)
+                       {
+                       /* Default handling if value == size field then omit */
+                       if (*tbool && (it->size > 0))
+                               return -1;
+                       if (!*tbool && !it->size)
+                               return -1;
+                       }
                c = (unsigned char)*tbool;
                cont = &c;
                len = 1;