aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-07-14 22:27:22 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-07-14 22:27:22 +0530
commitba099b6818cdedaefe8f0e850091d25e1d493aed (patch)
tree5f92c66814f4ba1b5084bbdaea8c7b4b71ac72cc
parent0bc5d82d2f479a8fb87831e536e4640b586bf103 (diff)
downloadnnn-ba099b6818cdedaefe8f0e850091d25e1d493aed.tar.gz
Fix coolsize
-rw-r--r--src/nnn.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 1096451..f1bad2c 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2199,7 +2199,7 @@ static char *coolsize(off_t size)
}
if (i > 0 && i < 6 && rem) {
- ret = xstrlcpy(size_buf, xitoa(size), 11);
+ ret = xstrlcpy(size_buf, xitoa(size), 12);
size_buf[ret - 1] = '.';
char *frac = xitoa(rem);
@@ -2208,13 +2208,13 @@ static char *coolsize(off_t size)
if (len < toprint) {
size_buf[ret] = size_buf[ret + 1] = size_buf[ret + 2] = '0';
- xstrlcpy(size_buf + ret + (toprint - len), frac, (toprint - len) + 1);
+ xstrlcpy(size_buf + ret + (toprint - len), frac, len + 1);
} else
xstrlcpy(size_buf + ret, frac, toprint + 1);
ret += toprint;
} else {
- ret = xstrlcpy(size_buf, size ? xitoa(size) : "0", 10);
+ ret = xstrlcpy(size_buf, size ? xitoa(size) : "0", 12);
--ret;
}