zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit d711f459ae1b73f7a1e6e6b596c1aff3066ecc29 (tree)
parent b3e495a38a5e334f5e30e255592f810e0017919c
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Thu,  5 Jan 2023 16:36:55 -0700

std.crypto.tls.Client: fix crash in read()

An abstraction for giving bytes to the read buffer didn't check for an
out-of-space condition.

Diffstat:
Mlib/std/crypto/tls/Client.zig | 1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/lib/std/crypto/tls/Client.zig b/lib/std/crypto/tls/Client.zig @@ -1207,6 +1207,7 @@ const VecPut = struct { /// Returns the amount actually put which is always equal to bytes.len /// unless the vectors ran out of space. fn put(vp: *VecPut, bytes: []const u8) usize { + if (vp.idx >= vp.iovecs.len) return 0; var bytes_i: usize = 0; while (true) { const v = vp.iovecs[vp.idx];