Skip to content

Commit e350064

Browse files
committed
Fix from review
1 parent 25afaa6 commit e350064

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

src/x509.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11711,16 +11711,23 @@ WOLF_STACK_OF(WOLFSSL_X509_OBJECT)* wolfSSL_sk_X509_OBJECT_deep_copy(
1171111711
cert->isCA = req->isCa;
1171211712
cert->basicConstSet = req->basicConstSet;
1171311713
#ifdef WOLFSSL_CERT_EXT
11714-
if (req->subjKeyIdSz <= CTC_MAX_SKID_SIZE) {
11715-
if (req->subjKeyId) {
11714+
if (req->subjKeyIdSz > CTC_MAX_SKID_SIZE) {
11715+
WOLFSSL_MSG("Subject Key ID too large");
11716+
WOLFSSL_ERROR_VERBOSE(BUFFER_E);
11717+
ret = WOLFSSL_FAILURE;
11718+
}
11719+
else if (req->subjKeyIdSz > 0) {
11720+
if (req->subjKeyId == NULL) {
11721+
WOLFSSL_MSG("Subject Key ID missing");
11722+
ret = WOLFSSL_FAILURE;
11723+
}
11724+
else {
1171611725
XMEMCPY(cert->skid, req->subjKeyId, req->subjKeyIdSz);
11726+
cert->skidSz = (int)req->subjKeyIdSz;
1171711727
}
11718-
cert->skidSz = (int)req->subjKeyIdSz;
1171911728
}
1172011729
else {
11721-
WOLFSSL_MSG("Subject Key ID too large");
11722-
WOLFSSL_ERROR_VERBOSE(BUFFER_E);
11723-
ret = WOLFSSL_FAILURE;
11730+
cert->skidSz = 0;
1172411731
}
1172511732
if (ret == WOLFSSL_SUCCESS) {
1172611733
if (req->keyUsageSet)

0 commit comments

Comments
 (0)