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:47:41 +0000 (21:47 +0100)
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 0fb9990480919163cc375a2b6c0df1d8d901a77b)

crypto/objects/obj_dat.c

index 9654775a476eb9181fee07a2d6c347bbd7f16701..b7d1b8351b68c515b1266b974f0a0a64419dcbd2 100644 (file)
@@ -382,6 +382,9 @@ int OBJ_obj2nid(const ASN1_OBJECT *a)
     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 */