osd.c: in OSD_HandleChar() for TAB, fix use of uninitialized osd->editor.buf[i].

Exposed by Valgrind. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4963 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-02-07 17:29:13 +00:00
parent de2a14290f
commit c6b9fa52d9

View file

@ -1033,7 +1033,7 @@ int32_t OSD_HandleChar(char ch)
if (!lastmatch)
{
for (i=osd->editor.pos; i>0; i--) if (osd->editor.buf[i-1] == ' ') break;
for (j=0; osd->editor.buf[i] != ' ' && i < osd->editor.len; j++,i++)
for (j=0; i < osd->editor.len && osd->editor.buf[i] != ' '; j++,i++)
osd->editor.tmp[j] = osd->editor.buf[i];
osd->editor.tmp[j] = 0;