From c515200599f09825a86a7b22a65a6beef9bfacc0 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" 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 cfa97275d7ee..35f38a463876 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