Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -11578,8 +11578,10 @@ int wolfSSL_set_compression(WOLFSSL* ssl)

WOLFSSL_ENTER("wolfSSL_writev");

for (i = 0; i < iovcnt; i++)
sending += iov[i].iov_len;
for (i = 0; i < iovcnt; i++) {
if (!WC_SAFE_SUM_WORD32(sending, (word32)iov[i].iov_len, sending))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but technically over 80 chars...

[check-source-text] [4 of 52] [c243f41193]
    configure...   real 0m11.105s  user 0m5.781s  sys 0m3.870s
    [skipping "codespell" subtest in check-source-text -- codespell is missing or too old]
overlong lines added:
src/ssl.c:11582                 if (!WC_SAFE_SUM_WORD32(sending, (word32)iov[i].iov_len, sending))
    check-source-text OK

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops, there's still a defect here -- you can't blindly truncate .iov_len to word32. you have to check if it fits in a word32 before casting it. we should use size_t for accumulation, and implement WC_SAFE_SUM_SIZE_T().

return BUFFER_E;
}

if (sending > sizeof(staticBuffer)) {
myBuffer = (byte*)XMALLOC(sending, ssl->heap,
Expand Down