From a00b8833b1f90b51b8882f0976e8c59fe5754cca Mon Sep 17 00:00:00 2001 From: blub Date: Tue, 5 Jan 2010 18:21:52 +0000 Subject: [PATCH] fixing a possible invalid memory access spotted by a_grue git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9785 d7cf8633-e32d-0410-b094-e92efae38249 --- console.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/console.c b/console.c index 90f80248..23c3fdb0 100644 --- 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; -- 2.39.2