~sircmpwn/hare-ssh

450e5859c8779287212d7320184bb64869ad0eff — Drew DeVault a month ago 06cf8df
net::ssh: improve max message length handling
1 files changed, 4 insertions(+), 4 deletions(-)

M net/ssh/client.ha
M net/ssh/client.ha => net/ssh/client.ha +4 -4
@@ 130,6 130,9 @@ export fn client_read(client: *client) (packet | io::EOF | error) = {
			yield mac_digestsz(mac);
		};
		msglen = pktlen + maclen + 4;
		if (msglen >= MAX_PACKETSIZE) {
			return protoerror;
		};
	};
	if (msglen <= len(client.rbuf)) {
		return client_decode(client);


@@ 142,13 145,10 @@ export fn client_read(client: *client) (packet | io::EOF | error) = {
	case let z: size =>
		yield z;
	};
	append(client.rbuf, buf[..z]...);

	// XXX: We could do some kind of streaming decoder for large packets,
	// but it might be a bit of a challenge.
	if (len(client.rbuf) >= MAX_PACKETSIZE) {
		return protoerror;
	};
	append(client.rbuf, buf[..z]...);
	return client_decode(client);
};