Browse Source

P2P: Verify that os_get_random() succeeds

Be more consistent with os_get_random() use (CID 72710).

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen 10 years ago
parent
commit
5e62cfdf75
1 changed files with 2 additions and 1 deletions
  1. 2 1
      wpa_supplicant/p2p_supplicant.c

+ 2 - 1
wpa_supplicant/p2p_supplicant.c

@@ -5075,7 +5075,8 @@ static int wpas_p2p_select_freq_no_pref(struct wpa_supplicant *wpa_s,
 	unsigned int i, r;
 
 	/* first try some random selection of the social channels */
-	os_get_random((u8 *) &r, sizeof(r));
+	if (os_get_random((u8 *) &r, sizeof(r)) < 0)
+		return -1;
 
 	for (i = 0; i < 3; i++) {
 		params->freq = 2412 + ((r + i) % 3) * 25;