mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
Merge pull request #1558 from dgarske/fsanitize
Fixes for fsanitize reports
This commit is contained in:
14
src/crl.c
14
src/crl.c
@@ -373,12 +373,14 @@ int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert)
|
||||
|
||||
WOLFSSL_MSG("Issuing missing CRL callback");
|
||||
url[0] = '\0';
|
||||
if (cert->extCrlInfoSz < (int)sizeof(url) -1 ) {
|
||||
XMEMCPY(url, cert->extCrlInfo, cert->extCrlInfoSz);
|
||||
url[cert->extCrlInfoSz] = '\0';
|
||||
}
|
||||
else {
|
||||
WOLFSSL_MSG("CRL url too long");
|
||||
if (cert->extCrlInfo) {
|
||||
if (cert->extCrlInfoSz < (int)sizeof(url) -1 ) {
|
||||
XMEMCPY(url, cert->extCrlInfo, cert->extCrlInfoSz);
|
||||
url[cert->extCrlInfoSz] = '\0';
|
||||
}
|
||||
else {
|
||||
WOLFSSL_MSG("CRL url too long");
|
||||
}
|
||||
}
|
||||
|
||||
crl->cm->cbMissingCRL(url);
|
||||
|
@@ -7699,7 +7699,7 @@ int CopyDecodedToX509(WOLFSSL_X509* x509, DecodedCert* dCert)
|
||||
|
||||
XMEMCPY(x509->serial, dCert->serial, EXTERNAL_SERIAL_SIZE);
|
||||
x509->serialSz = dCert->serialSz;
|
||||
if (dCert->subjectCNLen < ASN_NAME_MAX) {
|
||||
if (dCert->subjectCN && dCert->subjectCNLen < ASN_NAME_MAX) {
|
||||
XMEMCPY(x509->subjectCN, dCert->subjectCN, dCert->subjectCNLen);
|
||||
x509->subjectCN[dCert->subjectCNLen] = '\0';
|
||||
}
|
||||
@@ -8982,8 +8982,10 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
||||
}
|
||||
|
||||
/* store for callback use */
|
||||
if (args->dCert->subjectCNLen < ASN_NAME_MAX) {
|
||||
XMEMCPY(args->domain, args->dCert->subjectCN, args->dCert->subjectCNLen);
|
||||
if (args->dCert->subjectCN &&
|
||||
args->dCert->subjectCNLen < ASN_NAME_MAX) {
|
||||
XMEMCPY(args->domain, args->dCert->subjectCN,
|
||||
args->dCert->subjectCNLen);
|
||||
args->domain[args->dCert->subjectCNLen] = '\0';
|
||||
}
|
||||
else {
|
||||
|
@@ -3612,8 +3612,8 @@ int wolfSSL_SetVersion(WOLFSSL* ssl, int version)
|
||||
/* Make a work from the front of random hash */
|
||||
static INLINE word32 MakeWordFromHash(const byte* hashID)
|
||||
{
|
||||
return (hashID[0] << 24) | (hashID[1] << 16) | (hashID[2] << 8) |
|
||||
hashID[3];
|
||||
return ((word32)hashID[0] << 24) | (hashID[1] << 16) |
|
||||
(hashID[2] << 8) | hashID[3];
|
||||
}
|
||||
|
||||
#endif /* !NO_CERTS || !NO_SESSION_CACHE */
|
||||
|
@@ -199,6 +199,7 @@ STATIC INLINE void xorbuf(void* buf, const void* mask, word32 count)
|
||||
STATIC INLINE void ForceZero(const void* mem, word32 len)
|
||||
{
|
||||
volatile byte* z = (volatile byte*)mem;
|
||||
|
||||
#if defined(WOLFSSL_X86_64_BUILD) && defined(WORD64_AVAILABLE)
|
||||
volatile word64* w;
|
||||
#ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS
|
||||
@@ -213,6 +214,7 @@ STATIC INLINE void ForceZero(const void* mem, word32 len)
|
||||
*w++ = 0;
|
||||
z = (volatile byte*)w;
|
||||
#endif
|
||||
|
||||
while (len--) *z++ = 0;
|
||||
}
|
||||
|
||||
@@ -299,7 +301,7 @@ STATIC INLINE void ato16(const byte* c, word16* wc_u16)
|
||||
/* convert opaque to 32 bit integer */
|
||||
STATIC INLINE void ato32(const byte* c, word32* wc_u32)
|
||||
{
|
||||
*wc_u32 = (c[0] << 24) | (c[1] << 16) | (c[2] << 8) | c[3];
|
||||
*wc_u32 = ((word32)c[0] << 24) | (c[1] << 16) | (c[2] << 8) | c[3];
|
||||
}
|
||||
|
||||
|
||||
|
@@ -645,7 +645,7 @@ static void scryptROMix(byte* x, byte* v, byte* y, int r, word32 n)
|
||||
#endif
|
||||
#else
|
||||
byte* t = x + (2*r - 1) * 64;
|
||||
j = (t[0] | (t[1] << 8) | (t[2] << 16) | (t[3] << 24)) & (n-1);
|
||||
j = (t[0] | (t[1] << 8) | (t[2] << 16) | ((word32)t[3] << 24)) & (n-1);
|
||||
#endif
|
||||
#ifdef WORD64_AVAILABLE
|
||||
for (k = 0; k < bSz / 8; k++)
|
||||
|
@@ -485,7 +485,7 @@ void fp_mul_comba(fp_int *A, fp_int *B, fp_int *C)
|
||||
|
||||
for (ix = 0; ix < pa; ix++) {
|
||||
/* get offsets into the two bignums */
|
||||
ty = MIN(ix, B->used-1);
|
||||
ty = MIN(ix, (B->used > 0 ? B->used - 1 : 0));
|
||||
tx = ix - ty;
|
||||
|
||||
/* setup temp aliases */
|
||||
|
Reference in New Issue
Block a user