]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Fix random channel selection to use os_get_random
authorJouni Malinen <j@w1.fi>
Sun, 31 Oct 2010 10:27:37 +0000 (12:27 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 31 Oct 2010 10:27:37 +0000 (12:27 +0200)
This could have been using an uninitialized variable instead of
purposefully random value in picking up the channel. There is not
much of a difference for the use case here, but anyway, we may
as well do what was initially planned here and.

wpa_supplicant/p2p_supplicant.c

index 1219f690c3be0f17f7f4e0375fa9baf2d799f1d9..022ae38f761864fa14f0b36415c5f2cb5c3b3311 100644 (file)
@@ -2187,6 +2187,7 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
                 * For initial tests, pick the operation channel randomly.
                 * TODO: Use scan results (etc.) to select the best channel.
                 */
+               os_get_random((u8 *) &r, sizeof(r));
                p2p.op_channel = 1 + r % 11;
        }
        wpa_printf(MSG_DEBUG, "P2P: Own listen channel: %d  "