Skip to content

std.crypto.tls.Client.readvAdvanced: fix bugs#15754

Merged
andrewrk merged 1 commit intomasterfrom
tls-client-fix
May 18, 2023
Merged

std.crypto.tls.Client.readvAdvanced: fix bugs#15754
andrewrk merged 1 commit intomasterfrom
tls-client-fix

Conversation

@andrewrk
Copy link
Member

  • When there is buffered cleartext, return it without calling the underlying read function. This prevents buffer overflow due to space used up by cleartext.
  • Avoid clearing the buffer when the buffered cleartext could not be completely given to the result read buffer, and there is some buffered ciphertext left.
  • Instead of rounding up the amount of bytes to ask for to the nearest TLS record size, round down, with a minimum of 1. This prevents the code path from being taken which requires extra memory copies.
  • Avoid calling @memcpy with overlapping arguments.

closes #15590

 * When there is buffered cleartext, return it without calling the
   underlying read function. This prevents buffer overflow due to space
   used up by cleartext.
 * Avoid clearing the buffer when the buffered cleartext could not be
   completely given to the result read buffer, and there is some
   buffered ciphertext left.
 * Instead of rounding up the amount of bytes to ask for to the nearest
   TLS record size, round down, with a minimum of 1. This prevents the
   code path from being taken which requires extra memory copies.
 * Avoid calling `@memcpy` with overlapping arguments.

closes #15590
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zig build: panic while downloading package

1 participant