]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
gui: Fix a bug in align_str().
authorAndre Noll <maan@systemlinux.org>
Fri, 21 Aug 2009 19:05:36 +0000 (21:05 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 21 Aug 2009 19:05:36 +0000 (21:05 +0200)
This bug was introduced in 01117585. It messes up the display and can lead to a
segfault.

gui.c

diff --git a/gui.c b/gui.c
index b37f8fbd5d6db608b9c3086f508809aa52500737..5b44819c05afc074fadca3a5a7d5c1ece9fe8b8f 100644 (file)
--- 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] = ' ';
        }