From 738c57eeaa7958aae6600f6f668fbda8a5128cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20B=C3=A9nard?= Date: Tue, 28 Aug 2012 17:24:26 +0200 Subject: [PATCH] stringlist: fix division by zero MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit len is checked instead of num so when num is zero, we get a division by zero a few lines later Signed-off-by: Eric BĂ©nard Signed-off-by: Sascha Hauer --- lib/stringlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/stringlist.c b/lib/stringlist.c index b965aa058..a8af15d75 100644 --- a/lib/stringlist.c +++ b/lib/stringlist.c @@ -87,8 +87,8 @@ void string_list_print_by_column(struct string_list *sl) return; num = 80 / (len + 1); - if (len == 0) - len = 1; + if (num == 0) + num = 1; i = 0; list_for_each_entry(entry, &sl->list, list) {