aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2010-01-26 15:42:24 +0200
committerLasse Collin <lasse.collin@tukaani.org>2010-01-26 15:42:24 +0200
commitd9a9800597ea540090e434132c3b511217df0a2b (patch)
tree9dbd96ef90975133ff304af770da4a172e1bce10 /src
parentMinor comment fix. (diff)
downloadxz-d9a9800597ea540090e434132c3b511217df0a2b.tar.xz
Fix too small static buffer in util.c.
This was introduced in 0dd6d007669b946543ca939a44243833c79e08f4 two days ago.
Diffstat (limited to '')
-rw-r--r--src/xz/util.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/xz/util.c b/src/xz/util.c
index a962421f..784f6d30 100644
--- a/src/xz/util.c
+++ b/src/xz/util.c
@@ -175,13 +175,14 @@ uint64_to_nicestr(uint64_t value, enum nicestr_unit unit_min,
static const char suffix[5][4] = { "B", "KiB", "MiB", "GiB", "TiB" };
// Minimum buffer size:
- // 11 "1,234.5 MiB"
+ // 26 2^64 with thousand separators
+ // 4 " KiB"
// 2 " ("
// 26 2^64 with thousand separators
// 3 " B)"
// 1 '\0'
- // 43 Total
- static char buf[4][44];
+ // 62 Total
+ static char buf[4][64];
char *pos = buf[slot];
size_t left = sizeof(buf[slot]);
my_snprintf(&pos, &left, "%s %s", str, suffix[unit]);
@@ -196,8 +197,6 @@ uint64_to_nicestr(uint64_t value, enum nicestr_unit unit_min,
extern const char *
double_to_str(double value)
{
- // 64 bytes is surely enough, since it won't fit in some other
- // fields anyway.
static char buf[64];
static enum { UNKNOWN, WORKS, BROKEN } thousand = UNKNOWN;