Date: Sat, 21 May 2016 17:52:44 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300377 - head/sys/compat/ndis Message-ID: <201605211752.u4LHqiHQ031457@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Sat May 21 17:52:44 2016 New Revision: 300377 URL: https://svnweb.freebsd.org/changeset/base/300377 Log: 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 Modified: head/sys/compat/ndis/subr_ntoskrnl.c Modified: head/sys/compat/ndis/subr_ntoskrnl.c ============================================================================== --- head/sys/compat/ndis/subr_ntoskrnl.c Sat May 21 17:38:43 2016 (r300376) +++ head/sys/compat/ndis/subr_ntoskrnl.c Sat May 21 17:52:44 2016 (r300377) @@ -3189,7 +3189,7 @@ static int rand(void) { - return (random()); + return (random() / 2 + 1); } static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605211752.u4LHqiHQ031457>