Merge pull request #611 from JacobBarthelmeh/sshd

truncate vsnprintf
pull/617/head
John Safranek 2023-11-04 20:57:04 -07:00 committed by GitHub
commit f9aebbcd40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -173,7 +173,7 @@ void wolfSSH_Log(enum wolfSSH_LogLevel level, const char *const fmt, ...)
/* format msg */ /* format msg */
va_start(vlist, fmt); va_start(vlist, fmt);
WVSNPRINTF(msgStr, sizeof(msgStr), fmt, vlist); WVSNPRINTF(msgStr, sizeof(msgStr)-1, fmt, vlist);
va_end(vlist); va_end(vlist);
if (logFunction) if (logFunction)

View File

@ -499,7 +499,7 @@ extern "C" {
#define WSTRNCPY(s1,s2,n) strncpy_s((s1),(n),(s2),(n)) #define WSTRNCPY(s1,s2,n) strncpy_s((s1),(n),(s2),(n))
#define WSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n)) #define WSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n))
#define WSNPRINTF(s,n,f,...) _snprintf_s((s),(n),_TRUNCATE,(f),##__VA_ARGS__) #define WSNPRINTF(s,n,f,...) _snprintf_s((s),(n),_TRUNCATE,(f),##__VA_ARGS__)
#define WVSNPRINTF(s,n,f,...) _vsnprintf_s((s),(n),(n),(f),##__VA_ARGS__) #define WVSNPRINTF(s,n,f,...) _vsnprintf_s((s),(n),_TRUNCATE,(f),##__VA_ARGS__)
#define WSTRTOK(s1,s2,s3) strtok_s((s1),(s2),(s3)) #define WSTRTOK(s1,s2,s3) strtok_s((s1),(s2),(s3))
#elif defined(MICROCHIP_MPLAB_HARMONY) || defined(MICROCHIP_PIC32) #elif defined(MICROCHIP_MPLAB_HARMONY) || defined(MICROCHIP_PIC32)
#include <stdio.h> #include <stdio.h>