From 8ae31617a1826332e96320d87bf82d18ca52b35b Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Thu, 30 Jan 2014 13:19:19 +0100 Subject: [PATCH] tyls: Make sure we never divide by zero Avoid the case where cols is 0 and we divide through it. CID 1100655 --- src/bin/tyls.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/tyls.c b/src/bin/tyls.c index 82ef6c72..d046163b 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++) {