mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
get_random_data() can return NULL (for instance, if we can't open /dev/random
on Unix), yet cmdgen failed to deal with this. Spotted by Darren Tucker. [originally from svn r7396]
This commit is contained in:
parent
2b0d1b0224
commit
36db0d6f72
5
cmdgen.c
5
cmdgen.c
@ -640,6 +640,11 @@ int main(int argc, char **argv)
|
||||
|
||||
random_ref();
|
||||
entropy = get_random_data(bits / 8);
|
||||
if (!entropy) {
|
||||
fprintf(stderr, "puttygen: failed to collect entropy, "
|
||||
"could not generate key\n");
|
||||
return 1;
|
||||
}
|
||||
random_add_heavynoise(entropy, bits / 8);
|
||||
memset(entropy, 0, bits/8);
|
||||
sfree(entropy);
|
||||
|
Loading…
Reference in New Issue
Block a user