os_unix: Call srandom() only if os_get_random() succeeds
Don't use uninitialized stack memory if /dev/urandom is not available. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
17ba51b14d
commit
a17cbcd698
1 changed files with 2 additions and 2 deletions
|
@ -367,8 +367,8 @@ int os_program_init(void)
|
|||
capset(&header, &cap);
|
||||
#endif /* ANDROID */
|
||||
|
||||
os_get_random((unsigned char *) &seed, sizeof(seed));
|
||||
srandom(seed);
|
||||
if (os_get_random((unsigned char *) &seed, sizeof(seed)) == 0)
|
||||
srandom(seed);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue