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 <wolfssl/ssl.h>
#include <ifaddrs.h> #include <ifaddrs.h>
#include <applibs/log.h> #include <applibs/log.h>
#include <netdb.h>
#define _GNU_SOURCE /* defines NI_NUMERICHOST */ #define _GNU_SOURCE /* defines NI_NUMERICHOST */
#ifndef NI_MAXHOST #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"); WOLFSSL_MSG("Memory error");
return rc; return rc;
} }
if (sk->next) { valLen = XSNPRINTF(val, len, "%*s%s", indent, "",
if ((valLen = XSNPRINTF(val, len, "%*s%s,", str->strData);
indent, "", str->strData)) if ((valLen < 0) || (valLen >= len)
>= len) { || ((tmpLen + valLen) >= tmpSz)) {
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) {
XFREE(val, NULL, DYNAMIC_TYPE_TMP_BUFFER); XFREE(val, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return rc; return rc;
} }