Skip to content

Commit d711f45

Browse files
committed
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.
1 parent b3e495a commit d711f45

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

lib/std/crypto/tls/Client.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,7 @@ const VecPut = struct {
12071207
/// Returns the amount actually put which is always equal to bytes.len
12081208
/// unless the vectors ran out of space.
12091209
fn put(vp: *VecPut, bytes: []const u8) usize {
1210+
if (vp.idx >= vp.iovecs.len) return 0;
12101211
var bytes_i: usize = 0;
12111212
while (true) {
12121213
const v = vp.iovecs[vp.idx];

0 commit comments

Comments
 (0)