osd.c: patch up a possible oob access of osdtext[].

git-svn-id: https://svn.eduke32.com/eduke32@4210 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-12-24 09:44:20 +00:00
parent a4510e35a1
commit a2d0008e32

View file

@ -1491,6 +1491,12 @@ void OSD_Draw(void)
for (; lines>0; lines--, row--)
{
// XXX: May happen, which would ensue an oob if not checked.
// Last char accessed is osdtext[topoffs + osdcols-1].
// Reproducible by running test.lua with -Lopts=diag
// and scrolling to the top.
if (topoffs + osdcols-1 >= sizeof(osdtext))
break;
drawosdstr(0,row,osdtext+topoffs,osdcols,osdtextshade,osdtextpal);
topoffs+=osdcols;
}