Skip to content

Commit 730db6a

Browse files
committed
Address Jacob's comment
1 parent 0ebe581 commit 730db6a

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

src/x509.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,22 @@ WOLFSSL_X509_EXTENSION* wolfSSL_X509_set_ext(WOLFSSL_X509* x509, int loc)
686686
/* extCount == loc. Now get the extension. */
687687
/* Check if extension has been set */
688688
isSet = wolfSSL_X509_ext_isSet_by_NID((WOLFSSL_X509*)x509, nid);
689-
ext->obj = wolfSSL_OBJ_nid2obj(nid);
690-
if (ext->obj != NULL) {
689+
690+
if (wolfSSL_OBJ_nid2ln(nid) != NULL) {
691+
/* This is NOT an unknown OID. */
692+
ext->obj = wolfSSL_OBJ_nid2obj(nid);
693+
if (ext->obj == NULL) {
694+
WOLFSSL_MSG("\tfail: Invalid OBJECT");
695+
wolfSSL_X509_EXTENSION_free(ext);
696+
FreeDecodedCert(cert);
697+
#ifdef WOLFSSL_SMALL_STACK
698+
XFREE(cert, NULL, DYNAMIC_TYPE_DCERT);
699+
#endif
700+
return NULL;
701+
}
702+
}
703+
704+
if (ext->obj) {
691705
ext->obj->nid = nid;
692706
}
693707

0 commit comments

Comments
 (0)