lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1161352724.3135.18.camel@dyn-9-152-230-71.boeblingen.de.ibm.com>
Date:	Fri, 20 Oct 2006 15:58:44 +0200
From:	Martin Peschke <mp3@...ibm.com>
To:	Andrew Morton <akpm@...l.org>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [Patch] statistics: fix buffer overflow in histogram with linear
	scale

Values outside the range covered by a histogram with linear
scale resulted in invalid indices pointing to non-existing
'buckets'. Index is adjusted to array boundaries, if required.

Signed-off-by: Martin Peschke <mp3@...ibm.com>
---

 statistic.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff -urp a/lib/statistic.c b/lib/statistic.c
--- a/lib/statistic.c	2006-10-08 23:03:56.000000000 +0200
+++ b/lib/statistic.c	2006-10-12 19:38:08.000000000 +0200
@@ -994,9 +994,12 @@ static s64 statistic_histogram_calc_valu
 
 static int statistic_histogram_calc_index_lin(struct statistic *stat, s64 value)
 {
-	unsigned long long i = value - stat->u.histogram.range_min;
+	unsigned long long i;
+	if (value <= stat->u.histogram.range_min)
+		return 0;
+	i = value - stat->u.histogram.range_min;
 	do_div(i, stat->u.histogram.base_interval);
-	return i;
+	return min(i, (unsigned long long)(stat->u.histogram.last_index));
 }
 
 static int statistic_histogram_calc_index_log2(struct statistic *stat,


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ