Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen Fix out of bounds read for very large numbers (...
details: https://anonhg.NetBSD.org/src/rev/83e16eb97a95
branches: trunk
changeset: 352888:83e16eb97a95
user: christos <christos%NetBSD.org@localhost>
date: Thu Apr 13 17:45:56 2017 +0000
description:
Fix out of bounds read for very large numbers (pointed out by Brooks Davis)
https://svnweb.freebsd.org/changeset/base/316766
diffstat:
lib/libc/gen/humanize_number.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (30 lines):
diff -r 0e4780a1696c -r 83e16eb97a95 lib/libc/gen/humanize_number.c
--- a/lib/libc/gen/humanize_number.c Thu Apr 13 17:21:29 2017 +0000
+++ b/lib/libc/gen/humanize_number.c Thu Apr 13 17:45:56 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: humanize_number.c,v 1.16 2012/03/17 20:01:14 christos Exp $ */
+/* $NetBSD: humanize_number.c,v 1.17 2017/04/13 17:45:56 christos Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: humanize_number.c,v 1.16 2012/03/17 20:01:14 christos Exp $");
+__RCSID("$NetBSD: humanize_number.c,v 1.17 2017/04/13 17:45:56 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -76,9 +76,9 @@
}
#define SCALE2PREFIX(scale) (&prefixes[(scale) << 1])
- maxscale = 7;
+ maxscale = 6;
- if ((size_t)scale >= maxscale &&
+ if ((size_t)scale > maxscale &&
(scale & (HN_AUTOSCALE | HN_GETSCALE)) == 0)
return (-1);
Home |
Main Index |
Thread Index |
Old Index