diff options
author | Matthieu Herrb <matthieu@herrb.eu> | 2021-08-03 08:37:30 +0200 |
---|---|---|
committer | Matthieu Herrb <matthieu@herrb.eu> | 2021-08-03 08:37:30 +0200 |
commit | 8adde9ff142130cd3f927a200b573db7b9b6a533 (patch) | |
tree | 1097fa105b1d3931cffa27050f69ef8f5d5459f9 | |
parent | 01080057a35b54abce715884ae9fa1938b78d497 (diff) |
Fix character buffer sizes to hold full formatted strings
-rw-r--r-- | xrestop.c | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -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) |