]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fixing a possible invalid memory access spotted by a_grue
authorblub <blub@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 5 Jan 2010 18:21:52 +0000 (18:21 +0000)
committerblub <blub@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 5 Jan 2010 18:21:52 +0000 (18:21 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9785 d7cf8633-e32d-0410-b094-e92efae38249

console.c

index 90f80248f917bf82e107c12d8c49c94ed17e5e54..23c3fdb0822103b3c61c81e4763f2d399ef3b120 100644 (file)
--- a/console.c
+++ b/console.c
@@ -1383,9 +1383,9 @@ void Con_DrawInput (void)
 
        y = (int)strlen(text);
 
-// fill out remainder with spaces
-       for (i = y; i < (int)sizeof(editlinecopy)-1; i++)
-               text[i] = ' ';
+       // append enoug nul-bytes to cover the utf8-versions of the cursor too
+       for (i = y; i < y + 4 && i < sizeof(editlinecopy); ++i)
+               text[i] = 0;
 
        // add the cursor frame
        if ((int)(realtime*con_cursorspeed) & 1)                // cursor is visible
@@ -1415,7 +1415,7 @@ void Con_DrawInput (void)
                x = 0;
 
        // draw it
-       DrawQ_String(x, con_vislines - con_textsize.value*2, text, 0, con_textsize.value, con_textsize.value, 1.0, 1.0, 1.0, 1.0, 0, NULL, false, FONT_CONSOLE );
+       DrawQ_String(x, con_vislines - con_textsize.value*2, text, y + 3, con_textsize.value, con_textsize.value, 1.0, 1.0, 1.0, 1.0, 0, NULL, false, FONT_CONSOLE );
 
        // remove cursor
 //     key_line[key_linepos] = 0;