mirror of
https://github.com/clearml/dropbear
synced 2025-02-07 21:23:51 +00:00
Fix segfault when /dev/urandom isn't writable
This commit is contained in:
parent
90b5691183
commit
e55e468754
3
random.c
3
random.c
@ -157,6 +157,9 @@ static void write_urandom()
|
|||||||
/* This is opportunistic, don't worry about failure */
|
/* This is opportunistic, don't worry about failure */
|
||||||
unsigned char buf[INIT_SEED_SIZE];
|
unsigned char buf[INIT_SEED_SIZE];
|
||||||
FILE *f = fopen(DROPBEAR_URANDOM_DEV, "w");
|
FILE *f = fopen(DROPBEAR_URANDOM_DEV, "w");
|
||||||
|
if (!f) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
genrandom(buf, sizeof(buf));
|
genrandom(buf, sizeof(buf));
|
||||||
fwrite(buf, sizeof(buf), 1, f);
|
fwrite(buf, sizeof(buf), 1, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
Loading…
Reference in New Issue
Block a user