Don't try to parse non string types.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 1 Jul 2004 18:15:33 +0000 (18:15 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 1 Jul 2004 18:15:33 +0000 (18:15 +0000)
apps/asn1pars.c

index 305db15..f1d8bc8 100644 (file)
@@ -309,6 +309,7 @@ bad:
                for (i=0; i<sk_num(osk); i++)
                        {
                        ASN1_TYPE *atmp;
                for (i=0; i<sk_num(osk); i++)
                        {
                        ASN1_TYPE *atmp;
+                       int typ;
                        j=atoi(sk_value(osk,i));
                        if (j == 0)
                                {
                        j=atoi(sk_value(osk,i));
                        if (j == 0)
                                {
@@ -327,6 +328,15 @@ bad:
                                ERR_print_errors(bio_err);
                                goto end;
                                }
                                ERR_print_errors(bio_err);
                                goto end;
                                }
+                       typ = ASN1_TYPE_get(at);
+                       if ((typ == V_ASN1_OBJECT)
+                               || (typ == V_ASN1_NULL))
+                               {
+                               BIO_printf(bio_err, "Can't parse %s type\n",
+                                       typ == V_ASN1_NULL ? "NULL" : "OBJECT");
+                               ERR_print_errors(bio_err);
+                               goto end;
+                               }
                        /* hmm... this is a little evil but it works */
                        tmpbuf=at->value.asn1_string->data;
                        tmplen=at->value.asn1_string->length;
                        /* hmm... this is a little evil but it works */
                        tmpbuf=at->value.asn1_string->data;
                        tmplen=at->value.asn1_string->length;