Skip to content

Commit fc63047

Browse files
committed
Additional related minor fixes
1 parent ae1da8a commit fc63047

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/ssl.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14544,10 +14544,13 @@ void* wolfSSL_GetHKDFExtractCtx(WOLFSSL* ssl)
1454414544
}
1454514545
else if (a->type == WOLFSSL_GEN_DNS || a->type == WOLFSSL_GEN_EMAIL ||
1454614546
a->type == WOLFSSL_GEN_URI) {
14547-
bufSz = (int)XSTRLEN((const char*)a->obj);
14548-
if (bufSz >= bufLen) {
14547+
size_t objLen = XSTRLEN((const char*)a->obj);
14548+
if (objLen >= (size_t)bufLen) {
1454914549
bufSz = bufLen - 1;
1455014550
}
14551+
else {
14552+
bufSz = (int)objLen;
14553+
}
1455114554
XMEMCPY(buf, a->obj, (size_t)bufSz);
1455214555
}
1455314556
else if ((bufSz = wolfssl_obj2txt_numeric(buf, bufLen, a)) > 0) {

src/ssl_load.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4290,7 +4290,7 @@ int wolfSSL_CTX_use_AltPrivateKey_Id(WOLFSSL_CTX* ctx, const unsigned char* id,
42904290
}
42914291
}
42924292
if (ret == 1) {
4293-
XMEMCPY(ctx->altPrivateKey->buffer, id, sz);
4293+
XMEMCPY(ctx->altPrivateKey->buffer, id, (word32)sz);
42944294
ctx->altPrivateKeyId = 1;
42954295
if (devId != INVALID_DEVID) {
42964296
ctx->altPrivateKeyDevId = devId;
@@ -4704,12 +4704,12 @@ int wolfSSL_use_AltPrivateKey_Id(WOLFSSL* ssl, const unsigned char* id, long sz,
47044704
#endif
47054705
}
47064706
if (AllocDer(&ssl->buffers.altKey, (word32)sz, ALT_PRIVATEKEY_TYPE,
4707-
ssl->heap) == 0) {
4707+
ssl->heap) != 0) {
47084708
ret = 0;
47094709
}
47104710
}
47114711
if (ret == 1) {
4712-
XMEMCPY(ssl->buffers.altKey->buffer, id, sz);
4712+
XMEMCPY(ssl->buffers.altKey->buffer, id, (word32)sz);
47134713
ssl->buffers.weOwnAltKey = 1;
47144714
ssl->buffers.altKeyId = 1;
47154715
if (devId != INVALID_DEVID) {
@@ -4752,7 +4752,7 @@ int wolfSSL_use_AltPrivateKey_Label(WOLFSSL* ssl, const char* label, int devId)
47524752
#endif
47534753
}
47544754
if (AllocDer(&ssl->buffers.altKey, (word32)sz, ALT_PRIVATEKEY_TYPE,
4755-
ssl->heap) == 0) {
4755+
ssl->heap) != 0) {
47564756
ret = 0;
47574757
}
47584758
}

0 commit comments

Comments
 (0)