aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Schmidt <stefan@datenfreihafen.org>2014-01-30 13:19:19 +0100
committerStefan Schmidt <stefan@datenfreihafen.org>2014-02-26 10:46:42 +0100
commit8ae31617a1826332e96320d87bf82d18ca52b35b (patch)
treedbae1819cf08f57d8632cf6e3131a7f647d8563a
parentmain: Free config before shutdown. (diff)
downloadterminology-devs/stefan/coverity-fixes.tar.gz
tyls: Make sure we never divide by zerodevs/stefan/coverity-fixes
Avoid the case where cols is 0 and we divide through it. CID 1100655
-rw-r--r--src/bin/tyls.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/bin/tyls.c b/src/bin/tyls.c
index 82ef6c7..d046163 100644
--- a/src/bin/tyls.c
+++ b/src/bin/tyls.c
@@ -640,6 +640,7 @@ list_dir(const char *dir, int mode)
stuff--;
}
if (cols > num) cols = num;
+ if (cols == 0) cols = 1;
rows = ((num + (cols - 1)) / cols);
for (i = 0; i < rows; i++)
{