Fix infinite loop in OSD_StripColors() when trying to display a quote containing '^' not followed by a number.

This fixes Mission 2 of Platoon Leader, as reported by RunningDuke.

git-svn-id: https://svn.eduke32.com/eduke32@6478 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-10-15 23:10:09 +00:00
parent 486791b3ee
commit 2c7840d928

View file

@ -146,14 +146,21 @@ const char * OSD_StripColors(char *outBuf, const char *inBuf)
if (*inBuf == '^')
{
if (isdigit(*(inBuf+1)))
{
inBuf += 2 + !!isdigit(*(inBuf+2));
else if ((Btoupper(*(inBuf+1)) == 'O'))
inBuf += 2;
else if ((Btoupper(*(inBuf+1)) == 'S') && isdigit(*(inBuf+2)))
inBuf += 3;
continue;
}
else if ((Btoupper(*(inBuf+1)) == 'O'))
{
inBuf += 2;
continue;
}
else if ((Btoupper(*(inBuf+1)) == 'S') && isdigit(*(inBuf+2)))
{
inBuf += 3;
continue;
}
}
*(outBuf++) = *(inBuf++);
}