summaryrefslogtreecommitdiff
path: root/usr.sbin/npppd/pppoe
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2013-04-20 23:32:33 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2013-04-20 23:32:33 +0000
commit636870d61717d38e2a361956c0a747161cb08062 (patch)
treefafc0b3582e63af8a4c4ba8fcb648cbe51c31ebc /usr.sbin/npppd/pppoe
parentfe6a9d999717c6044f691f87a264cd4e8bb77021 (diff)
Don't use random() because it's not safe. Use arc4random() instead of
it. Suggested by deraadt.
Diffstat (limited to 'usr.sbin/npppd/pppoe')
-rw-r--r--usr.sbin/npppd/pppoe/pppoed.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/npppd/pppoe/pppoed.c b/usr.sbin/npppd/pppoe/pppoed.c
index 08fc717df5f..d06b6947051 100644
--- a/usr.sbin/npppd/pppoe/pppoed.c
+++ b/usr.sbin/npppd/pppoe/pppoed.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pppoed.c,v 1.12 2013/04/16 07:27:36 yasuoka Exp $ */
+/* $OpenBSD: pppoed.c,v 1.13 2013/04/20 23:32:32 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -28,7 +28,7 @@
/**@file
* This file provides the PPPoE(RFC2516) server(access concentrator)
* implementaion.
- * $Id: pppoed.c,v 1.12 2013/04/16 07:27:36 yasuoka Exp $
+ * $Id: pppoed.c,v 1.13 2013/04/20 23:32:32 yasuoka Exp $
*/
#include <sys/types.h>
#include <sys/param.h>
@@ -140,12 +140,12 @@ pppoed_init(pppoed *_this)
"ac-cookie hash create failed.", __func__);
_this->acookie_hash = NULL;
}
- _this->acookie_next = random();
+ _this->acookie_next = arc4random();
#if PPPOE_NSESSION > 0xffff
#error PPPOE_NSESSION must be less than 65536
#endif
- off = random() % 0xffff;
+ off = arc4random() % 0xffff;
for (i = 0; i < PPPOE_NSESSION; i++) {
id = (i + off) % 0xffff;
if (id == 0)