X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/2bc6a386c828835b75509281029b1b677f6725dc..51b2fb65e228f0a5a179429a48a4392da74de0c2:/ssh.c diff --git a/ssh.c b/ssh.c index 881919c7..7470163d 100644 --- a/ssh.c +++ b/ssh.c @@ -1783,7 +1783,8 @@ static int do_ssh1_login(unsigned char *in, int inlen, int ispkt) break; default: if (((c >= ' ' && c <= '~') || - ((unsigned char) c >= 160)) && pos < 40) { + ((unsigned char) c >= 160)) + && pos < sizeof(username)-1) { username[pos++] = c; c_write(&c, 1); } @@ -2053,9 +2054,7 @@ static int do_ssh1_login(unsigned char *in, int inlen, int ispkt) exit(0); break; default: - if (((c >= ' ' && c <= '~') || - ((unsigned char) c >= 160)) - && pos < sizeof(password)) + if (pos < sizeof(password)-1) password[pos++] = c; break; } @@ -3197,7 +3196,8 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt) break; default: if (((c >= ' ' && c <= '~') || - ((unsigned char) c >= 160)) && pos < 40) { + ((unsigned char) c >= 160)) + && pos < sizeof(username)-1) { username[pos++] = c; c_write(&c, 1); } @@ -3582,9 +3582,7 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt) exit(0); break; default: - if (((c >= ' ' && c <= '~') || - ((unsigned char) c >= 160)) - && pos < 40) + if (pos < sizeof(password)-1) password[pos++] = c; break; }