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

Missing error message when loading a private key file.

If the file is empty, or otherwise fails to start with a recognised
'PuTTY-User-Key-File' header line, we forgot to fill in the error
message before returning failure, leading to a null pointer
dereference.
This commit is contained in:
Simon Tatham 2018-10-09 18:07:52 +01:00
parent 78d0022c70
commit 3f0f6d2013

View File

@ -612,8 +612,10 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
}
/* Read the first header line which contains the key type. */
if (!read_header(fp, header))
if (!read_header(fp, header)) {
error = "no header line found in key file";
goto error;
}
if (0 == strcmp(header, "PuTTY-User-Key-File-2")) {
old_fmt = 0;
} else if (0 == strcmp(header, "PuTTY-User-Key-File-1")) {