Clip printext256() at xdim, don't crash OSD_Printf() with empty string.

git-svn-id: https://svn.eduke32.com/eduke32@3318 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-12-25 16:13:36 +00:00
parent 596b83aec1
commit 255c84c5a2
2 changed files with 10 additions and 0 deletions

View file

@ -15928,6 +15928,10 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const
if (col)col = Batol(smallbuf);
continue;
}
if (stx-fontsize+charxsiz > xdim)
break;
letptr = &fontptr[name[i]<<3];
ptr = (char *)(ylookup[ypos+7]+(stx-fontsize)+frameplace);
for (y=7; y>=0; y--)

View file

@ -1525,6 +1525,12 @@ void OSD_Printf(const char *fmt, ...)
Bvsnprintf(tmpstr, 8192, fmt, va);
va_end(va);
if (tmpstr[0]==0)
{
mutex_unlock(&m_osdprintf);
return;
}
if (tmpstr[0]=='^' && tmpstr[1]=='1' && tmpstr[2]=='0' && ++OSD_errors > MAX_ERRORS)
{
if (OSD_errors == MAX_ERRORS + 1)