Module Name: src Committed By: kre Date: Sat Jul 28 13:55:09 UTC 2018
Modified Files: src/external/bsd/cron/dist: entry.c Log Message: Add some more "crappy error detection" - the low value of the range of random_with_range() must not be negative (or now we are doing unsigned modulus we might generate a very big result). To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/external/bsd/cron/dist/entry.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/bsd/cron/dist/entry.c diff -u src/external/bsd/cron/dist/entry.c:1.9 src/external/bsd/cron/dist/entry.c:1.10 --- src/external/bsd/cron/dist/entry.c:1.9 Sat Jul 28 13:51:26 2018 +++ src/external/bsd/cron/dist/entry.c Sat Jul 28 13:55:08 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: entry.c,v 1.9 2018/07/28 13:51:26 kre Exp $ */ +/* $NetBSD: entry.c,v 1.10 2018/07/28 13:55:08 kre Exp $ */ /* * Copyright 1988,1990,1993,1994 by Paul Vixie @@ -26,7 +26,7 @@ #if 0 static char rcsid[] = "Id: entry.c,v 1.17 2004/01/23 18:56:42 vixie Exp"; #else -__RCSID("$NetBSD: entry.c,v 1.9 2018/07/28 13:51:26 kre Exp $"); +__RCSID("$NetBSD: entry.c,v 1.10 2018/07/28 13:55:08 kre Exp $"); #endif #endif @@ -468,7 +468,7 @@ random_with_range(int low, int high) { /* Kind of crappy error detection, but... */ - if (low >= high) + if (low < 0 || low >= high) return low; else return (int)(arc4random() % (unsigned)((high - low + 1) + low));