summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-05-21 17:52:44 +0000
committerpfg <pfg@FreeBSD.org>2016-05-21 17:52:44 +0000
commit334d424627d50cc4cc73e73954534e23a1f91168 (patch)
tree8e6527886eee50cea3b9335a35cf192bda236fc3
parente0f6fb692ee6ec627ff147b11b0c3840d5446b97 (diff)
downloadFreeBSD-src-334d424627d50cc4cc73e73954534e23a1f91168.zip
FreeBSD-src-334d424627d50cc4cc73e73954534e23a1f91168.tar.gz
ndis(4): Avoid overflow.
This is a long standing problem: our random() function returns an unsigned integer but the rand provided by ndis(4) returns an int. Scale it down. MFC after: 2 weeks
-rw-r--r--sys/compat/ndis/subr_ntoskrnl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/compat/ndis/subr_ntoskrnl.c b/sys/compat/ndis/subr_ntoskrnl.c
index cfa9727..35f38a4 100644
--- a/sys/compat/ndis/subr_ntoskrnl.c
+++ b/sys/compat/ndis/subr_ntoskrnl.c
@@ -3189,7 +3189,7 @@ static int
rand(void)
{
- return (random());
+ return (random() / 2 + 1);
}
static void
OpenPOWER on IntegriCloud