mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-01-26 21:42:21 +01:00
wolfcrypt/src/asn.c: rearrange check for null cname in EncodeName() to fix false positive -Wnull-dereference.
src/internal.c: suppress -Wnull-dereference locally in ProcessPeerCertParse() to fix false positive.
This commit is contained in:
@@ -10613,8 +10613,11 @@ static void AddHandShakeHeader(byte* output, word32 length,
|
||||
if (hs == NULL)
|
||||
return;
|
||||
|
||||
PRAGMA_GCC_DIAG_PUSH;
|
||||
PRAGMA_GCC("GCC diagnostic ignored \"-Wnull-dereference\"");
|
||||
hs->type = type;
|
||||
c32to24(length, hs->length); /* type and length same for each */
|
||||
PRAGMA_GCC_DIAG_POP;
|
||||
#ifdef WOLFSSL_DTLS
|
||||
if (ssl->options.dtls) {
|
||||
DtlsHandShakeHeader* dtls;
|
||||
@@ -23312,6 +23315,8 @@ int SendChangeCipher(WOLFSSL* ssl)
|
||||
|
||||
/* get output buffer */
|
||||
output = GetOutputBuffer(ssl);
|
||||
if (output == NULL)
|
||||
return BUFFER_E;
|
||||
|
||||
AddRecordHeader(output, 1, change_cipher_spec, ssl, CUR_ORDER);
|
||||
|
||||
|
||||
@@ -29915,19 +29915,18 @@ static int EncodeName(EncodedName* name, const char* nameStr,
|
||||
ret = BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_CUSTOM_OID
|
||||
if (ret == 0 && type == ASN_CUSTOM_NAME) {
|
||||
if (cname == NULL || cname->custom.oidSz == 0) {
|
||||
name->used = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
(void)cname;
|
||||
#endif
|
||||
|
||||
CALLOC_ASNSETDATA(dataASN, rdnASN_Length, ret, NULL);
|
||||
if (ret == 0) {
|
||||
#ifdef WOLFSSL_CUSTOM_OID
|
||||
if (type == ASN_CUSTOM_NAME) {
|
||||
if (cname == NULL || cname->custom.oidSz == 0) {
|
||||
name->used = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
(void)cname;
|
||||
#endif
|
||||
CALLOC_ASNSETDATA(dataASN, rdnASN_Length, ret, NULL);
|
||||
nameSz = (word32)XSTRLEN(nameStr);
|
||||
/* Copy the RDN encoding template. ASN.1 tag for the name string is set
|
||||
* based on type. */
|
||||
|
||||
Reference in New Issue
Block a user