mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
cmdgen: add missing null pointer check in --dump mode.
A user pointed out that once we've identified the key algorithm from
an apparent public-key blob, we call ssh_key_new_pub on the blob data
and assume it will succeed. But there are plenty of ways it could
still fail, and ssh_key_new_pub could return NULL.
(cherry picked from commit 0c21eb4447
)
This commit is contained in:
parent
11b89407f5
commit
27a04d96a3
4
cmdgen.c
4
cmdgen.c
@ -1283,6 +1283,10 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
ssh_key *sk = ssh_key_new_pub(
|
ssh_key *sk = ssh_key_new_pub(
|
||||||
alg, ptrlen_from_strbuf(ssh2blob));
|
alg, ptrlen_from_strbuf(ssh2blob));
|
||||||
|
if (!sk) {
|
||||||
|
fprintf(stderr, "puttygen: unable to decode public key\n");
|
||||||
|
RETURN(1);
|
||||||
|
}
|
||||||
kc = ssh_key_components(sk);
|
kc = ssh_key_components(sk);
|
||||||
ssh_key_free(sk);
|
ssh_key_free(sk);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user