Test OBJ_obj2nid() with an undefined (NID_undef) object.
authorjsing <jsing@openbsd.org>
Fri, 11 Feb 2022 16:39:50 +0000 (16:39 +0000)
committerjsing <jsing@openbsd.org>
Fri, 11 Feb 2022 16:39:50 +0000 (16:39 +0000)
regress/lib/libcrypto/objects/objectstest.c

index 1a9674c..c1890d8 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: objectstest.c,v 1.1 2022/02/11 16:34:23 jsing Exp $ */
+/* $OpenBSD: objectstest.c,v 1.2 2022/02/11 16:39:50 jsing Exp $ */
 /*
  * Copyright (c) 2017, 2022 Joel Sing <jsing@openbsd.org>
  *
@@ -211,7 +211,7 @@ obj_nid_test(struct obj_test *ot)
        int nid;
        int failed = 1;
 
-       if (ot->nid == NID_undef)
+       if (ot->nid == NID_undef && ot->oid != NULL)
                return 0;
 
        if ((obj = OBJ_nid2obj(ot->nid)) == NULL) {