From 17bdfea554db239ad609a6272db5ca9f2dcf9e93 Mon Sep 17 00:00:00 2001 From: Aidan Keefe Date: Thu, 25 Jun 2026 14:50:33 -0600 Subject: [PATCH] https://fenrir.wolfssl.com/finding/1290 https://fenrir.wolfssl.com/finding/2110 https://fenrir.wolfssl.com/finding/2110 skoll fixes --- dtls/client-dtls-cid.c | 9 +++++---- embedded/tls-info.h | 5 +++-- tls/memory-tls.c | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dtls/client-dtls-cid.c b/dtls/client-dtls-cid.c index 9888840ab..d76106f88 100644 --- a/dtls/client-dtls-cid.c +++ b/dtls/client-dtls-cid.c @@ -141,10 +141,11 @@ int main (int argc, char** argv) printf("wolfSSL_read failed"); } } - - /* Add a terminating character to the generic server message */ - recvLine[n] = '\0'; - fputs(recvLine, stdout); + else { + /* Add a terminating character to the generic server message */ + recvLine[n] = '\0'; + fputs(recvLine, stdout); + } close(sockfd); if ( (sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { diff --git a/embedded/tls-info.h b/embedded/tls-info.h index 559299947..1ebc6d2a0 100644 --- a/embedded/tls-info.h +++ b/embedded/tls-info.h @@ -105,9 +105,10 @@ static WC_INLINE void ShowX509Ex(WOLFSSL_X509* x509, const char* hdr, /* testsuite has multiple threads writing to stdout, get output message ready to write once */ - strLen = sprintf(serialMsg, " %s", words[3]); + strLen = snprintf(serialMsg, sizeof(serialMsg), " %s", words[3]); for (i = 0; i < sz; i++) - sprintf(serialMsg + strLen + (i*3), ":%02x ", serial[i]); + snprintf(serialMsg + strLen + (i*3), + ((int)sizeof(serialMsg)) - strLen - (i*3), ":%02x ", serial[i]); printf("%s\n", serialMsg); } diff --git a/tls/memory-tls.c b/tls/memory-tls.c index 663ac8551..4ac7e1c49 100644 --- a/tls/memory-tls.c +++ b/tls/memory-tls.c @@ -153,7 +153,7 @@ static void* client_thread(void* args) wolfSSL_SetIORecv(cli_ctx, ClientRecv); WOLFSSL* cli_ssl = wolfSSL_new(cli_ctx); - if (cli_ctx == NULL) err_sys("bad client new"); + if (cli_ssl == NULL) err_sys("bad client new"); ret = wolfSSL_connect(cli_ssl); if (ret != WOLFSSL_SUCCESS) err_sys("bad client tls connect"); @@ -185,7 +185,7 @@ int main() wolfSSL_SetIORecv(srv_ctx, ServerRecv); WOLFSSL* srv_ssl = wolfSSL_new(srv_ctx); - if (srv_ctx == NULL) err_sys("bad server new"); + if (srv_ssl == NULL) err_sys("bad server new"); /* start client thread */ pthread_t tid;