1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-10 07:38:06 -05:00

Fix an SSH-breaking bug from the fuzzing merge.

When we set ssh->sc{cipher,mac} to s->sc{cipher,mac}_tobe
conditionally, we should be conditionalising on the values we're
_reading_, not the ones we're about to overwrite.

Thanks to Colin Harrison for this patch.
This commit is contained in:
Simon Tatham 2015-11-07 20:15:24 +00:00
parent f3230c8545
commit b003e5cf53

4
ssh.c
View File

@ -7312,14 +7312,14 @@ static void do_ssh2_transport(Ssh ssh, const void *vin, int inlen,
*/
if (ssh->sc_cipher_ctx)
ssh->sccipher->free_context(ssh->sc_cipher_ctx);
if (ssh->sccipher) {
if (s->sccipher_tobe) {
ssh->sccipher = s->sccipher_tobe;
ssh->sc_cipher_ctx = ssh->sccipher->make_context();
}
if (ssh->sc_mac_ctx)
ssh->scmac->free_context(ssh->sc_mac_ctx);
if (ssh->scmac) {
if (s->scmac_tobe) {
ssh->scmac = s->scmac_tobe;
ssh->scmac_etm = s->scmac_etm_tobe;
ssh->sc_mac_ctx = ssh->scmac->make_context(ssh->sc_cipher_ctx);