From: Andre Noll Date: Fri, 21 Aug 2009 19:05:36 +0000 (+0200) Subject: gui: Fix a bug in align_str(). X-Git-Tag: v0.4.0~38 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=174e032ea3bf040bc8ef9c35832d254126f1c09c gui: Fix a bug in align_str(). This bug was introduced in 01117585. It messes up the display and can lead to a segfault. --- diff --git a/gui.c b/gui.c index b37f8fbd..5b44819c 100644 --- a/gui.c +++ b/gui.c @@ -309,7 +309,7 @@ static int align_str(WINDOW* win, char *str, unsigned int len, num = 0; } /* replace newlines by spaces */ - for (i = 0; i < len; i++) { + for (i = 0; i < len && str[i]; i++) { if (str[i] == '\n') str[i] = ' '; }