diff options
author | Mark Hindley <mark@hindley.org.uk> | 2018-11-12 09:22:09 +0000 |
---|---|---|
committer | Mark Hindley <mark@hindley.org.uk> | 2018-11-12 09:22:09 +0000 |
commit | a7bee29ae34de50a86bf64d4ea9f69bdbc3b27e4 (patch) | |
tree | ac6c9abfefdc4286c4f52167738c4e4d35c96cd4 /src/basic/terminal-util.c | |
parent | 98f0f1042d219289b880436fad42823433648d18 (diff) | |
parent | 2cc17d30309a1db16cccbf376a59ae40e47b6959 (diff) |
Merge branch 'merge_upstream' into debian_WIP
Diffstat (limited to 'src/basic/terminal-util.c')
-rw-r--r-- | src/basic/terminal-util.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index f8623f9fd..d8e5d0d2e 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -830,11 +830,11 @@ unsigned columns(void) { if (e) (void) safe_atoi(e, &c); - if (c <= 0) + if (c <= 0 || c > USHRT_MAX) { c = fd_columns(STDOUT_FILENO); - - if (c <= 0) - c = 80; + if (c <= 0) + c = 80; + } cached_columns = c; return cached_columns; @@ -864,11 +864,11 @@ unsigned lines(void) { if (e) (void) safe_atoi(e, &l); - if (l <= 0) + if (l <= 0 || l > USHRT_MAX) { l = fd_lines(STDOUT_FILENO); - - if (l <= 0) - l = 24; + if (l <= 0) + l = 24; + } cached_lines = l; return cached_lines; |