DFS: Check os_get_random() result

This use does not really need a strong random number, so fall back to
os_random() if a theoretical error case occurs. (CID 72682)

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-10-11 19:41:33 +03:00
parent 24661bbadc
commit 7c0e5b58f9
1 changed files with 2 additions and 1 deletions

View File

@ -440,7 +440,8 @@ dfs_get_valid_channel(struct hostapd_iface *iface,
if (num_available_chandefs == 0)
return NULL;
os_get_random((u8 *) &_rand, sizeof(_rand));
if (os_get_random((u8 *) &_rand, sizeof(_rand)) < 0)
_rand = os_random();
chan_idx = _rand % num_available_chandefs;
dfs_find_channel(iface, &chan, chan_idx, skip_radar);