WPS UPnP: Check os_get_random() result more consistently
While the value here would not matter much, make the implementation more consistent (CID 72692). Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
e7b96ecdb3
commit
683b408a9e
1 changed files with 2 additions and 1 deletions
|
@ -317,7 +317,8 @@ static void advertisement_state_machine_handler(void *eloop_data,
|
||||||
* (see notes above)
|
* (see notes above)
|
||||||
*/
|
*/
|
||||||
next_timeout_msec = 0;
|
next_timeout_msec = 0;
|
||||||
os_get_random((void *) &r, sizeof(r));
|
if (os_get_random((void *) &r, sizeof(r)) < 0)
|
||||||
|
r = 32768;
|
||||||
next_timeout_sec = UPNP_CACHE_SEC / 4 +
|
next_timeout_sec = UPNP_CACHE_SEC / 4 +
|
||||||
(((UPNP_CACHE_SEC / 4) * r) >> 16);
|
(((UPNP_CACHE_SEC / 4) * r) >> 16);
|
||||||
sm->advertise_count++;
|
sm->advertise_count++;
|
||||||
|
|
Loading…
Reference in a new issue