1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

openssh_new_read: fix misaimed null pointer check.

If the input key_wanted field were set to an out-of-range value, the
parent structure retkey would not become NULL as a whole: instead, its
field 'key' would never be set to a non-null pointer. So I was testing
the wrong pointer.

Fortunately, this couldn't have come up, because we don't actually
have any support yet for loading the nth key from an OpenSSH new-style
key file containing more than one. So key_wanted was always set to 0
by load_openssh_new_key(), which also checked that the file's key
count was exactly 1 (guarding against the possibility that even 0
might have been an out-of-range index).
This commit is contained in:
Simon Tatham 2019-05-05 08:32:49 +01:00
parent cddec53a40
commit f1fe0c7d8d

View File

@ -1442,7 +1442,7 @@ static ssh2_userkey *openssh_new_read(
}
}
if (!retkey) {
if (!retkey->key) {
errmsg = "key index out of range";
goto error;
}