aboutsummaryrefslogtreecommitdiff
path: root/src/units.c
diff options
context:
space:
mode:
authorBruce A. Mah <bmah@kitchenlab.org>2017-10-04 10:15:19 -0700
committerGitHub <noreply@github.com>2017-10-04 10:15:19 -0700
commit25f5947512bcc929c0f0acba899c288ba7547dbf (patch)
tree1873604ed646b596e47b91cdcbe0276d2fc562a5 /src/units.c
parent2bc3d2ee5d13f9bbf811daf5fabc9e833b34fdbd (diff)
downloadiperf3-25f5947512bcc929c0f0acba899c288ba7547dbf.tar.gz
Fix a problem formatting very large numbers. (#642)
Avoid walking off the end of an array when trying to format a number larger than 1000T. Motivated by #641, as reported by @shingchuang, but slightly reimplemented.
Diffstat (limited to 'src/units.c')
-rw-r--r--src/units.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/units.c b/src/units.c
index f9533f0..7376a0b 100644
--- a/src/units.c
+++ b/src/units.c
@@ -303,14 +303,14 @@ extern "C"
if (isupper((int) inFormat))
{
- while (tmpNum >= 1024.0 && conv <= TERA_CONV)
+ while (tmpNum >= 1024.0 && conv < TERA_CONV)
{
tmpNum /= 1024.0;
conv++;
}
} else
{
- while (tmpNum >= 1000.0 && conv <= TERA_CONV)
+ while (tmpNum >= 1000.0 && conv < TERA_CONV)
{
tmpNum /= 1000.0;
conv++;