File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments