From: divverent Date: Thu, 5 Mar 2015 10:48:41 +0000 (+0000) Subject: Fix crash in inputline. X-Git-Tag: xonotic-v0.8.1~8^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e6486761b694551ddb2c7ae9c87262c9a84f58fe;p=xonotic%2Fdarkplaces.git Fix crash in inputline. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12197 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/keys.c b/keys.c index 32648560..62db1675 100644 --- a/keys.c +++ b/keys.c @@ -1189,9 +1189,17 @@ Key_Console (int key, int unicode) // can't use strcpy to move string to right len++; //memmove(&key_line[key_linepos + u8_bytelen(key_line + key_linepos, 1)], &key_line[key_linepos], len); + if (key_linepos + blen + len >= MAX_INPUTLINE) + return; memmove(&key_line[key_linepos + blen], &key_line[key_linepos], len); } + // FIXME: This is not proper overwriting with utf8. + if (key_linepos + blen >= MAX_INPUTLINE) + return; memcpy(key_line + key_linepos, buf, blen); + if (blen > len) + key_line[key_linepos + blen] = 0; + // END OF FIXME key_linepos += blen; //key_linepos += u8_fromchar(unicode, key_line + key_linepos, sizeof(key_line) - key_linepos - 1); //key_line[key_linepos] = ascii;