1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-23 14:05:03 -05:00

Fix translation of legacy key format *again*.

As well as eliminating the null-pointer dereference, I also now
realise that the format-translation code depended on leaving the final
translated string in 'otherstr' in order to pass the host key check
afterwards (if they match).

I've also now realised that this only applies to *SSH-1* RSA keys, so
it's even more obsolete than I thought before. Perhaps I should just
remove this code instead of spending all this effort on fixing it. But
I've done the fix now, so I'll commit it, and then maybe we can remove
it afterwards (and have a working version of it available to resurrect
if ever needed!).
This commit is contained in:
Simon Tatham 2022-04-28 12:50:00 +01:00
parent 93fb65af61
commit 7b0292b2c3

View File

@ -321,10 +321,13 @@ int check_stored_host_key(const char *hostname, int port,
* format. If not, we'll assume something odd went
* wrong, and hyper-cautiously do nothing.
*/
if (!strcmp(new->s, key))
if (!strcmp(new->s, key)) {
put_reg_sz(rkey, regname->s, new->s);
otherstr = strbuf_to_str(new);
} else {
strbuf_free(new);
}
}
sfree(oldstyle);
}