summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/human.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/human.c b/lib/human.c
index 6acc03243..79336624a 100644
--- a/lib/human.c
+++ b/lib/human.c
@@ -35,6 +35,7 @@
#include <argmatch.h>
#include <error.h>
+#include <intprops.h>
#include <xstrtol.h>
#ifndef SIZE_MAX
@@ -99,10 +100,8 @@ group_number (char *number, size_t numberlen,
size_t i = numberlen;
/* The maximum possible value for NUMBERLEN is the number of digits
- in the square of the largest uintmax_t, so double the size of
- uintmax_t before converting to a bound. 302 / 1000 is ceil
- (log10 (2.0)). Add 1 for integer division truncation. */
- char buf[2 * sizeof (uintmax_t) * CHAR_BIT * 302 / 1000 + 1];
+ in the square of the largest uintmax_t, so double the size needed. */
+ char buf[2 * INT_STRLEN_BOUND (uintmax_t) + 1];
memcpy (buf, number, numberlen);
d = number + numberlen;