diff options
author | Jonathan Lebon <jlebon@redhat.com> | 2016-07-22 09:21:09 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2016-07-22 09:36:51 -0400 |
commit | c072ef1ebab052bdecb0d9a52c14813728f83859 (patch) | |
tree | 8a91115fa46fee299992ad83e22fb862925edee6 | |
parent | d2e588d94fabacfeb5b08790365161a015a00b98 (diff) | |
download | libglnx-c072ef1ebab052bdecb0d9a52c14813728f83859.tar.gz |
text_percent_internal: compare uints before printing
A wild sordid tale of substractions and unsigned integers leads this
team of variables down a loonng path...
Reported-by: Gatis Paeglis <gatis.paeglis@qt.io>
-rw-r--r-- | glnx-console.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/glnx-console.c b/glnx-console.c index d40702e..416d276 100644 --- a/glnx-console.c +++ b/glnx-console.c @@ -221,9 +221,11 @@ text_percent_internal (const char *text, if (percentage == -1) { - const guint spacelen = ncolumns - input_textlen; fwrite (text, 1, input_textlen, stdout); - printpad (spaces, n_spaces, spacelen); + + /* Overwrite remaining space, if any */ + if (ncolumns > input_textlen) + printpad (spaces, n_spaces, ncolumns - input_textlen); } else { |