return correct NID for undefined object
authorDr. Stephen Henson <steve@openssl.org>
Mon, 8 Jun 2015 12:23:00 +0000 (13:23 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 8 Jun 2015 20:44:56 +0000 (21:44 +0100)
Reviewed-by: Tim Hudson <tjh@openssl.org>
crypto/objects/obj_dat.c

index 27d61b3a43a866b6bd599595fe6d35b069fd3b56..e8a6b139ddad7b52dbae94499a75c19e8c9f76bb 100644 (file)
@@ -397,6 +397,9 @@ int OBJ_obj2nid(const ASN1_OBJECT *a)
     if (a->nid != 0)
         return (a->nid);
 
     if (a->nid != 0)
         return (a->nid);
 
+    if (a->length == 0)
+        return NID_undef;
+
     if (added != NULL) {
         ad.type = ADDED_DATA;
         ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
     if (added != NULL) {
         ad.type = ADDED_DATA;
         ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */