summaryrefslogtreecommitdiff
path: root/procps/nmeter.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-01-06 03:26:53 +0000
committerDenis Vlasenko2008-01-06 03:26:53 +0000
commit56ea65ca5f30778f05c8882b04e3a94c869bbca4 (patch)
tree85a5d24ca1a86b504779b034fd9e7dbe4dfffa38 /procps/nmeter.c
parent5fee2e1a79dc6fc05658821a86b0e7b5678a90dd (diff)
downloadbusybox-56ea65ca5f30778f05c8882b04e3a94c869bbca4.zip
busybox-56ea65ca5f30778f05c8882b04e3a94c869bbca4.tar.gz
ps: fix overflow in USER and VSZ columns
function old new delta smart_ulltoa4 - 280 +280 smart_ulltoa5 283 408 +125 ulltoa6_and_space - 25 +25 scale 28 38 +10 bbunpack 358 366 +8 ps_main 259 261 +2 glob3 35 37 +2 fill_bounds 172 174 +2 process_stdin 456 446 -10 smart_ulltoa6 406 - -406 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 6/1 up/down: 454/-416) Total: 38 bytes
Diffstat (limited to 'procps/nmeter.c')
-rw-r--r--procps/nmeter.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/procps/nmeter.c b/procps/nmeter.c
index b846ee5..b8ba3fa 100644
--- a/procps/nmeter.c
+++ b/procps/nmeter.c
@@ -257,7 +257,10 @@ static int rdval_diskstats(const char* p, ullong *vec)
static void scale(ullong ul)
{
char buf[5];
- smart_ulltoa5(ul, buf);
+
+ /* see http://en.wikipedia.org/wiki/Tera */
+ smart_ulltoa4(ul, buf, " kmgtpezy");
+ buf[4] = '\0';
put(buf);
}