From 334d424627d50cc4cc73e73954534e23a1f91168 Mon Sep 17 00:00:00 2001 From: pfg Date: Sat, 21 May 2016 17:52:44 +0000 Subject: [PATCH] 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 --- sys/compat/ndis/subr_ntoskrnl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/ndis/subr_ntoskrnl.c b/sys/compat/ndis/subr_ntoskrnl.c index cfa97275d7e..35f38a46387 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 -- 2.11.4.GIT