]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DFS: Check os_get_random() result
authorJouni Malinen <j@w1.fi>
Sat, 11 Oct 2014 16:41:33 +0000 (19:41 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 11 Oct 2014 16:43:36 +0000 (19:43 +0300)
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>
src/ap/dfs.c

index a6ec20bd92633e553ad292db8c4797d61ab8eb2e..6fc891c7afd656cf1c8e2a76be5171cad80e5d5e 100644 (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);