From eddb17399bc036c68a7bee849512304877d07b85 Mon Sep 17 00:00:00 2001 From: Markus Friedl Date: Wed, 8 Feb 2012 01:25:32 +0100 Subject: [PATCH] ssh_api.c: the client must not send anything before the protocol version --- ssh/ssh_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ssh/ssh_api.c b/ssh/ssh_api.c index 99d322d..e58f520 100644 --- a/ssh/ssh_api.c +++ b/ssh/ssh_api.c @@ -274,7 +274,7 @@ _ssh_read_banner(struct ssh *ssh, char **bannerp) struct sshbuf *input; char c, *s, buf[256], remote_version[256]; /* must be same size! */ int r, remote_major, remote_minor; - u_int i, n, j, len; + size_t i, n, j, len; *bannerp = NULL; input = ssh_packet_get_input(ssh); @@ -300,7 +300,7 @@ _ssh_read_banner(struct ssh *ssh, char **bannerp) if (strncmp(buf, "SSH-", 4) == 0) break; debug("ssh_exchange_identification: %s", buf); - if (++n > 65536) + if (ssh->kex->server || ++n > 65536) return SSH_ERR_NO_PROTOCOL_VERSION; } if ((r = sshbuf_consume(input, j)) != 0)