Skip to content

Commit f011012

Browse files
authored
Merge pull request #7300 from bandi13/codeSonarFixes
Code sonar fixes
2 parents b7c36fa + 717a328 commit f011012

2 files changed

Lines changed: 5 additions & 16 deletions

File tree

IDE/MSVS-2019-AZSPHERE/shared/util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <wolfssl/ssl.h>
2727
#include <ifaddrs.h>
2828
#include <applibs/log.h>
29+
#include <netdb.h>
2930

3031
#define _GNU_SOURCE /* defines NI_NUMERICHOST */
3132
#ifndef NI_MAXHOST

src/x509.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,22 +1545,10 @@ int wolfSSL_X509V3_EXT_print(WOLFSSL_BIO *out, WOLFSSL_X509_EXTENSION *ext,
15451545
WOLFSSL_MSG("Memory error");
15461546
return rc;
15471547
}
1548-
if (sk->next) {
1549-
if ((valLen = XSNPRINTF(val, len, "%*s%s,",
1550-
indent, "", str->strData))
1551-
>= len) {
1552-
XFREE(val, NULL, DYNAMIC_TYPE_TMP_BUFFER);
1553-
return rc;
1554-
}
1555-
} else {
1556-
if ((valLen = XSNPRINTF(val, len, "%*s%s",
1557-
indent, "", str->strData))
1558-
>= len) {
1559-
XFREE(val, NULL, DYNAMIC_TYPE_TMP_BUFFER);
1560-
return rc;
1561-
}
1562-
}
1563-
if ((tmpLen + valLen) >= tmpSz) {
1548+
valLen = XSNPRINTF(val, len, "%*s%s", indent, "",
1549+
str->strData);
1550+
if ((valLen < 0) || (valLen >= len)
1551+
|| ((tmpLen + valLen) >= tmpSz)) {
15641552
XFREE(val, NULL, DYNAMIC_TYPE_TMP_BUFFER);
15651553
return rc;
15661554
}

0 commit comments

Comments
 (0)