Merge pull request #7300 from bandi13/codeSonarFixes

Code sonar fixes
This commit is contained in:
Sean Parkinson
2024-03-07 10:17:06 +10:00
committed by GitHub
2 changed files with 5 additions and 16 deletions

View File

@@ -26,6 +26,7 @@
#include <wolfssl/ssl.h>
#include <ifaddrs.h>
#include <applibs/log.h>
#include <netdb.h>
#define _GNU_SOURCE /* defines NI_NUMERICHOST */
#ifndef NI_MAXHOST

View File

@@ -1545,22 +1545,10 @@ int wolfSSL_X509V3_EXT_print(WOLFSSL_BIO *out, WOLFSSL_X509_EXTENSION *ext,
WOLFSSL_MSG("Memory error");
return rc;
}
if (sk->next) {
if ((valLen = XSNPRINTF(val, len, "%*s%s,",
indent, "", str->strData))
>= len) {
XFREE(val, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return rc;
}
} else {
if ((valLen = XSNPRINTF(val, len, "%*s%s",
indent, "", str->strData))
>= len) {
XFREE(val, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return rc;
}
}
if ((tmpLen + valLen) >= tmpSz) {
valLen = XSNPRINTF(val, len, "%*s%s", indent, "",
str->strData);
if ((valLen < 0) || (valLen >= len)
|| ((tmpLen + valLen) >= tmpSz)) {
XFREE(val, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return rc;
}