src/ssl.c: fix overflow/overrun defect in wolfSSL_writev().

This commit is contained in:
Daniel Pouzzner
2025-10-14 16:29:15 -05:00
parent 014f55fe10
commit 204eb96d2f

View File

@@ -11549,15 +11549,17 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
#endif
byte* myBuffer = staticBuffer;
int dynamic = 0;
word32 sending = 0;
int idx = 0;
size_t sending = 0;
size_t idx = 0;
int i;
int ret;
WOLFSSL_ENTER("wolfSSL_writev");
for (i = 0; i < iovcnt; i++)
sending += iov[i].iov_len;
if (! WC_SAFE_SUM_UNSIGNED(size_t, sending, iov[i].iov_len,
sending))
return BUFFER_E;
if (sending > sizeof(staticBuffer)) {
myBuffer = (byte*)XMALLOC(sending, ssl->heap,