From d305e3b8214fe80dcdb321c16f498005f7ce9127 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Thu, 15 Jan 2015 21:28:35 -0600 Subject: [PATCH] Fix a bug where numbers could be truncated to four decimal digits in certain circumstances. This affected values from $RANDOM, and could potentially also result in corruption of pid values if they were large enough. --- libbb/xfuncs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 3caf5fd70..c54736be9 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c @@ -224,7 +224,7 @@ char* FAST_FUNC itoa_to_buf(int n, char *buf, unsigned buflen) // It so happens that sizeof(int) * 3 is enough for 32+ bit ints. // (sizeof(int) * 3 + 2 is correct for any width, even 8-bit) -static char local_buf[sizeof(int) * 3]; +static char local_buf[sizeof(int) * 3 + 2]; /* Convert unsigned integer to ascii using a static buffer (returned). */ char* FAST_FUNC utoa(unsigned n)