projects
/
mech_eap.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
P2P: Check os_get_random() return value more consistently
[mech_eap.git]
/
src
/
p2p
/
p2p_utils.c
diff --git
a/src/p2p/p2p_utils.c
b/src/p2p/p2p_utils.c
index
189300a
..
508a609
100644
(file)
--- a/
src/p2p/p2p_utils.c
+++ b/
src/p2p/p2p_utils.c
@@
-441,7
+441,8
@@
void p2p_channels_dump(struct p2p_data *p2p, const char *title,
static u8 p2p_channel_pick_random(const u8 *channels, unsigned int num_channels)
{
unsigned int r;
- os_get_random((u8 *) &r, sizeof(r));
+ if (os_get_random((u8 *) &r, sizeof(r)) < 0)
+ r = 0;
r %= num_channels;
return channels[r];
}