From 2c7840d92876e0ccef9313f163e6d71166d1a2ea Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sun, 15 Oct 2017 23:10:09 +0000 Subject: [PATCH] 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 --- source/build/src/osd.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/build/src/osd.cpp b/source/build/src/osd.cpp index f8d9e3599..fa4976974 100644 --- a/source/build/src/osd.cpp +++ b/source/build/src/osd.cpp @@ -146,13 +146,20 @@ const char * OSD_StripColors(char *outBuf, const char *inBuf) if (*inBuf == '^') { if (isdigit(*(inBuf+1))) + { inBuf += 2 + !!isdigit(*(inBuf+2)); + continue; + } else if ((Btoupper(*(inBuf+1)) == 'O')) + { inBuf += 2; + continue; + } else if ((Btoupper(*(inBuf+1)) == 'S') && isdigit(*(inBuf+2))) + { inBuf += 3; - - continue; + continue; + } } *(outBuf++) = *(inBuf++); }