From: simon Date: Fri, 29 Sep 2000 15:53:59 +0000 (+0000) Subject: Fix ssh2 after the rev 1.54 [r649] reorg broke it X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/commitdiff_plain/729e54b41014557a58caa06e25a51150c78b11d3 Fix ssh2 after the rev 1.54 [r649] reorg broke it git-svn-id: svn://svn.tartarus.org/sgt/putty@656 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/ssh.c b/ssh.c index fb31f011..15fd3c41 100644 --- a/ssh.c +++ b/ssh.c @@ -1876,18 +1876,18 @@ static int do_ssh2_transport(unsigned char *in, int inlen, int ispkt) } /* List client->server encryption algorithms. */ ssh2_pkt_addstring_start(); - for (i = -1; i < lenof(ciphers); i++) { - const struct ssh_cipher *c = i<0 ? preferred_cipher : ciphers[i]; + for (i = 0; i < lenof(ciphers)+1; i++) { + const struct ssh_cipher *c = i==0 ? preferred_cipher : ciphers[i-1]; ssh2_pkt_addstring_str(c->name); - if (i < lenof(ciphers)-1) + if (i < lenof(ciphers)) ssh2_pkt_addstring_str(","); } /* List server->client encryption algorithms. */ ssh2_pkt_addstring_start(); - for (i = -1; i < lenof(ciphers); i++) { - const struct ssh_cipher *c = i<0 ? preferred_cipher : ciphers[i]; + for (i = 0; i < lenof(ciphers)+1; i++) { + const struct ssh_cipher *c = i==0 ? preferred_cipher : ciphers[i-1]; ssh2_pkt_addstring_str(c->name); - if (i < lenof(ciphers)-1) + if (i < lenof(ciphers)) ssh2_pkt_addstring_str(","); } /* List client->server MAC algorithms. */ @@ -1958,18 +1958,18 @@ static int do_ssh2_transport(unsigned char *in, int inlen, int ispkt) } } ssh2_pkt_getstring(&str, &len); /* client->server cipher */ - for (i = -1; i < lenof(ciphers); i++) { - const struct ssh_cipher *c = i<0 ? preferred_cipher : ciphers[i]; + for (i = 0; i < lenof(ciphers)+1; i++) { + const struct ssh_cipher *c = i==0 ? preferred_cipher : ciphers[i-1]; if (in_commasep_string(c->name, str, len)) { - cscipher_tobe = ciphers[i]; + cscipher_tobe = c; break; } } ssh2_pkt_getstring(&str, &len); /* server->client cipher */ - for (i = -1; i < lenof(ciphers); i++) { - const struct ssh_cipher *c = i<0 ? preferred_cipher : ciphers[i]; + for (i = 0; i < lenof(ciphers)+1; i++) { + const struct ssh_cipher *c = i==0 ? preferred_cipher : ciphers[i-1]; if (in_commasep_string(c->name, str, len)) { - sccipher_tobe = ciphers[i]; + sccipher_tobe = c; break; } }