This commit is contained in:
Juliusz Sosinowicz
2021-10-15 19:44:09 +02:00
parent 1239a7f57d
commit 81c3f4b925

View File

@@ -20269,7 +20269,7 @@ int wolfSSL_X509_get_pubkey_buffer(WOLFSSL_X509* x509,
word32 idx; word32 idx;
const byte* der; const byte* der;
int length = 0; int length = 0;
int ret, derSz = 0; int ret = 0, derSz = 0;
int badDate = 0; int badDate = 0;
const byte* pubKeyX509 = NULL; const byte* pubKeyX509 = NULL;
int pubKeyX509Sz = 0; int pubKeyX509Sz = 0;
@@ -20291,6 +20291,7 @@ int wolfSSL_X509_get_pubkey_buffer(WOLFSSL_X509* x509,
#endif #endif
der = wolfSSL_X509_get_der(x509, &derSz); der = wolfSSL_X509_get_der(x509, &derSz);
if (der != NULL) {
InitDecodedCert(cert, der, derSz, NULL); InitDecodedCert(cert, der, derSz, NULL);
ret = wc_GetPubX509(cert, 0, &badDate); ret = wc_GetPubX509(cert, 0, &badDate);
if (ret >= 0) { if (ret >= 0) {
@@ -20300,8 +20301,8 @@ int wolfSSL_X509_get_pubkey_buffer(WOLFSSL_X509* x509,
cert->maxIdx); cert->maxIdx);
pubKeyX509Sz = length + (cert->srcIdx - idx); pubKeyX509Sz = length + (cert->srcIdx - idx);
} }
FreeDecodedCert(cert); FreeDecodedCert(cert);
}
#ifdef WOLFSSL_SMALL_STACK #ifdef WOLFSSL_SMALL_STACK
XFREE(cert, x509->heap, DYNAMIC_TYPE_TMP_BUFFER); XFREE(cert, x509->heap, DYNAMIC_TYPE_TMP_BUFFER);
#endif #endif