summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2021-08-03 08:37:30 +0200
committerMatthieu Herrb <matthieu@herrb.eu>2021-08-03 08:37:30 +0200
commit8adde9ff142130cd3f927a200b573db7b9b6a533 (patch)
tree1097fa105b1d3931cffa27050f69ef8f5d5459f9
parent01080057a35b54abce715884ae9fa1938b78d497 (diff)
Fix character buffer sizes to hold full formatted strings
-rw-r--r--xrestop.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/xrestop.c b/xrestop.c
index f1d262c..893d71b 100644
--- a/xrestop.c
+++ b/xrestop.c
@@ -488,10 +488,10 @@ static void
xrestop_display(XResTopApp *app)
{
int i;
- char pretty_pixmap_bytes[16] = { 0 };
- char pretty_other_bytes[16] = { 0 };
- char pretty_total_bytes[16] = { 0 };
- char pretty_pid[16] = { 0 };
+ char pretty_pixmap_bytes[20] = { 0 };
+ char pretty_other_bytes[20] = { 0 };
+ char pretty_total_bytes[20] = { 0 };
+ char pretty_pid[20] = { 0 };
if (!app->want_batch_mode)
{
@@ -505,9 +505,9 @@ xrestop_display(XResTopApp *app)
total_other_bytes += app->clients[i]->other_bytes;
}
- nice_bytes(pretty_pixmap_bytes, 16, total_pixmap_bytes);
- nice_bytes(pretty_other_bytes, 16, total_other_bytes);
- nice_bytes(pretty_total_bytes, 16,
+ nice_bytes(pretty_pixmap_bytes, sizeof(pretty_pixmap_bytes), total_pixmap_bytes);
+ nice_bytes(pretty_other_bytes, sizeof(pretty_other_bytes), total_other_bytes);
+ nice_bytes(pretty_total_bytes, sizeof(pretty_total_bytes),
total_pixmap_bytes + total_other_bytes);
/* Curses rendering */
@@ -533,9 +533,11 @@ xrestop_display(XResTopApp *app)
for (i=0; i<app->n_clients; i++)
{
- nice_bytes(pretty_pixmap_bytes, 16, app->clients[i]->pixmap_bytes);
- nice_bytes(pretty_other_bytes, 16, app->clients[i]->other_bytes);
- nice_bytes(pretty_total_bytes, 16,
+ nice_bytes(pretty_pixmap_bytes, sizeof(pretty_pixmap_bytes),
+ app->clients[i]->pixmap_bytes);
+ nice_bytes(pretty_other_bytes, sizeof(pretty_other_bytes),
+ app->clients[i]->other_bytes);
+ nice_bytes(pretty_total_bytes, sizeof(pretty_total_bytes),
app->clients[i]->pixmap_bytes + app->clients[i]->other_bytes);
if (app->clients[i]->pid > -1)