std.crypto.tls.Client: handle extra data after handshake

This commit is contained in:
Andrew Kelley 2022-12-21 19:01:21 -07:00
parent 16f936b420
commit 862ecf2344

View File

@ -583,15 +583,16 @@ pub fn init(stream: net.Stream, ca_bundle: Certificate.Bundle, host: []const u8)
});
},
};
std.debug.print("remaining bytes: {d}\n", .{len - end});
return .{
var client: Client = .{
.application_cipher = app_cipher,
.read_seq = 0,
.write_seq = 0,
.partially_read_buffer = undefined,
.partially_read_len = 0,
.partially_read_len = @intCast(u15, len - end),
.eof = false,
};
mem.copy(u8, &client.partially_read_buffer, handshake_buf[len..end]);
return client;
},
else => {
return error.TlsUnexpectedMessage;