From 174e032ea3bf040bc8ef9c35832d254126f1c09c Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 21 Aug 2009 21:05:36 +0200 Subject: [PATCH] gui: Fix a bug in align_str(). This bug was introduced in 01117585. It messes up the display and can lead to a segfault. --- gui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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] = ' '; } -- 2.39.5