too much padding
authorMischa POSLAWSKY <netris@shiar.org>
Sun, 4 Mar 2007 10:05:53 +0000 (11:05 +0100)
committerMischa POSLAWSKY <netris@shiar.org>
Sun, 4 Mar 2007 10:05:53 +0000 (11:05 +0100)
Memory overflow causing some nasty segfaults.

curses.c

index 7b5a26d0f3c524a205dd253ab7c79de4f75a1f60..5856f65f1b8d13b6c8519d09b819108a136ec50a 100644 (file)
--- a/curses.c
+++ b/curses.c
@@ -213,7 +213,7 @@ void DrawTitle(void)
        s = malloc(cols + 1);
        sprintf(s, " " MSG_TITLE " %s", version_string);
        const int titlelen = strlen(s);
-       memset(&s[titlelen], ' ', cols - strlen(MSG_TITLE)); // pad
+       memset(&s[titlelen], ' ', cols - titlelen); // pad
        if (cols > titlelen + 1 + strlen(MSG_TITLESUB))
                memcpy(&s[cols - 1 - strlen(MSG_TITLESUB)], MSG_TITLESUB, sizeof(MSG_TITLESUB) - 1);
        memcpy(&s[cols], "\0", 1);