From 4db2119a2bdb1aaaa85c450752749e6469d17af0 Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Wed, 13 May 2009 20:25:14 +0200 Subject: [PATCH] Bugfix: segfault with wrong config Altough the following configuration is wrong, it should only produce a error about a missing $endif but instead it also produced a segmentation fault: TEXT $if_gw$gw_ip$else --- src/conky.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/conky.c b/src/conky.c index 78f1b25c..f7ce451a 100644 --- a/src/conky.c +++ b/src/conky.c @@ -3260,7 +3260,8 @@ static void generate_text_internal(char *p, int p_max_size, #endif p[0] = 0; - for (obj = root.next; obj && p_max_size > 0; obj = obj->next) { + obj = root.next; + while (obj && p_max_size > 0) { needed = 0; // reset for top stuff /* IFBLOCK jumping algorithm @@ -5265,6 +5266,7 @@ static void generate_text_internal(char *p, int p_max_size, p += a; p_max_size -= a; } + obj = obj->next; } }