Correct an out of bounds read with HN_AUTOSCALE and very large numbers.
authorbrooks <brooks@FreeBSD.org>
Thu, 13 Apr 2017 15:49:32 +0000 (15:49 +0000)
committerbrooks <brooks@FreeBSD.org>
Thu, 13 Apr 2017 15:49:32 +0000 (15:49 +0000)
commit5c721276a47b15853bf1eabc03b23e1970375a1d
treea3de1412c040d198a775d0791f0a367f0746de4f
parent434a9744e1533859bf123acc09d498eecc39bb69
Correct an out of bounds read with HN_AUTOSCALE and very large numbers.

The maximum scale is 6 (K, M, G, T, P, E) (B is 0).

Overly large explict scales were checked correctly, but for sufficently
large numbers HN_AUTOSCALE would get to 7 resulting in an out of bounds
read.

Found with humanize_number_test and CHERI bounds checking.

Reviewed by: emaste
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10376
lib/libutil/humanize_number.c