mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Fix failure handling when loading a PPK file.
Coverity pointed out that I'd checked if the LoadedFile was NULL, set an error message ... and then accidentally fallen through to the success handler anyway.
This commit is contained in:
parent
d53b3bcd22
commit
ed1d64b48a
12
sshpubk.c
12
sshpubk.c
@ -993,12 +993,14 @@ ssh2_userkey *ppk_load_f(const Filename *filename, const char *passphrase,
|
||||
const char **errorstr)
|
||||
{
|
||||
LoadedFile *lf = lf_load_keyfile(filename, errorstr);
|
||||
if (!lf)
|
||||
ssh2_userkey *toret;
|
||||
if (lf) {
|
||||
toret = ppk_load_s(BinarySource_UPCAST(lf), passphrase, errorstr);
|
||||
lf_free(lf);
|
||||
} else {
|
||||
toret = NULL;
|
||||
*errorstr = "can't open file";
|
||||
|
||||
ssh2_userkey *toret = ppk_load_s(BinarySource_UPCAST(lf),
|
||||
passphrase, errorstr);
|
||||
lf_free(lf);
|
||||
}
|
||||
return toret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user