]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP: Check os_get_random() return value more consistently
authorJouni Malinen <j@w1.fi>
Sat, 11 Oct 2014 16:38:45 +0000 (19:38 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 11 Oct 2014 16:43:36 +0000 (19:43 +0300)
While this specific case does not really care what value is used, the
the theoretical error case can be handled more consistently. (CID 72684)

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/sta_info.c

index f0f01b4a2348a016a40034669b3da65ebd56a8e3..ed63aa8dafc3b28b7aa7b84e459524f4ad249c15 100644 (file)
@@ -904,7 +904,15 @@ static void ap_sa_query_timer(void *eloop_ctx, void *timeout_ctx)
        sta->sa_query_trans_id = nbuf;
        sta->sa_query_count++;
 
-       os_get_random(trans_id, WLAN_SA_QUERY_TR_ID_LEN);
+       if (os_get_random(trans_id, WLAN_SA_QUERY_TR_ID_LEN) < 0) {
+               /*
+                * We don't really care which ID is used here, so simply
+                * hardcode this if the mostly theoretical os_get_random()
+                * failure happens.
+                */
+               trans_id[0] = 0x12;
+               trans_id[1] = 0x34;
+       }
 
        timeout = hapd->conf->assoc_sa_query_retry_timeout;
        sec = ((timeout / 1000) * 1024) / 1000;