From: Jouni Malinen Date: Sat, 11 Oct 2014 16:41:33 +0000 (+0300) Subject: DFS: Check os_get_random() result X-Git-Tag: hostap_2_4~1339 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c0e5b58f998af8f018a227adec5cad5ff80bee3;p=thirdparty%2Fhostap.git 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 --- diff --git a/src/ap/dfs.c b/src/ap/dfs.c index a6ec20bd9..6fc891c7a 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -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);