mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 12:14:38 +02:00
Merge pull request #9006 from rlm2002/zd20212
Coverity fixes for Zendesk issue
This commit is contained in:
@@ -28850,10 +28850,6 @@ int SetSuitesHashSigAlgo(Suites* suites, const char* list)
|
||||
|
||||
do {
|
||||
if (*list == '+') {
|
||||
if (mac_alg != 0) {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
sig_alg = GetSigAlgFromName(s, (int)(list - s));
|
||||
if (sig_alg == 0) {
|
||||
ret = 0;
|
||||
|
@@ -1043,7 +1043,6 @@ static int wolfssl_asn1_integer_require_len(WOLFSSL_ASN1_INTEGER* a, int len,
|
||||
int ret = 1;
|
||||
byte* data;
|
||||
byte* oldData = a->intData;
|
||||
int oldLen = a->length;
|
||||
|
||||
if (a->isDynamic && (len > (int)a->dataMax)) {
|
||||
oldData = a->data;
|
||||
@@ -1051,7 +1050,6 @@ static int wolfssl_asn1_integer_require_len(WOLFSSL_ASN1_INTEGER* a, int len,
|
||||
a->data = a->intData;
|
||||
a->dataMax = (unsigned int)sizeof(a->intData);
|
||||
}
|
||||
a->length = 0;
|
||||
if ((!a->isDynamic) && (len > (int)a->dataMax)) {
|
||||
/* Create a new buffer to hold large integer value. */
|
||||
data = (byte*)XMALLOC((size_t)len, NULL, DYNAMIC_TYPE_OPENSSL);
|
||||
@@ -1068,10 +1066,10 @@ static int wolfssl_asn1_integer_require_len(WOLFSSL_ASN1_INTEGER* a, int len,
|
||||
if (keepOldData) {
|
||||
if (oldData != a->data) {
|
||||
/* Copy old data into new buffer. */
|
||||
XMEMCPY(a->data, oldData, (size_t)oldLen);
|
||||
XMEMCPY(a->data, oldData, (size_t)a->length);
|
||||
}
|
||||
/* Restore old length. */
|
||||
a->length = oldLen;
|
||||
} else {
|
||||
a->length = 0;
|
||||
}
|
||||
if (oldData != a->intData) {
|
||||
/* Dispose of the old dynamic data. */
|
||||
@@ -3549,7 +3547,7 @@ int wolfSSL_ASN1_STRING_print_ex(WOLFSSL_BIO *bio, WOLFSSL_ASN1_STRING *str,
|
||||
}
|
||||
}
|
||||
|
||||
if ((!err) && (str_len != -1)) {
|
||||
if ((!err) && (str_len >= 0)) {
|
||||
/* Include any characters written for type. */
|
||||
str_len += type_len;
|
||||
}
|
||||
|
@@ -1017,7 +1017,9 @@ int wc_ed448_import_public_ex(const byte* in, word32 inLen, ed448_key* key,
|
||||
ret = BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
if ((inLen != ED448_PUB_KEY_SIZE) && (inLen != ED448_PUB_KEY_SIZE + 1)) {
|
||||
if ((inLen != ED448_PUB_KEY_SIZE) &&
|
||||
(inLen != ED448_PUB_KEY_SIZE + 1) &&
|
||||
(inLen != 2 * ED448_PUB_KEY_SIZE + 1)) {
|
||||
ret = BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
|
@@ -1376,8 +1376,10 @@ void* wolfSSL_Realloc(void *ptr, size_t size, void* heap, int type)
|
||||
WOLFSSL_MSG("Error IO memory was not large enough");
|
||||
res = NULL; /* return NULL in error case */
|
||||
}
|
||||
else {
|
||||
res = pt->buffer;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
|
Reference in New Issue
Block a user