osd.c: Fix OSD_StripColors() with empty input string.

git-svn-id: https://svn.eduke32.com/eduke32@3727 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-05-04 16:36:13 +00:00
parent 1ec058a47f
commit d5a1f0a0d4
2 changed files with 3 additions and 3 deletions

View file

@ -219,7 +219,7 @@ const char *OSD_StripColors(char *out, const char *in)
{ {
const char *ptr = out; const char *ptr = out;
do while (*in)
{ {
if (*in == '^' && isdigit(*(in+1))) if (*in == '^' && isdigit(*(in+1)))
{ {
@ -240,10 +240,9 @@ const char *OSD_StripColors(char *out, const char *in)
} }
*(out++) = *(in++); *(out++) = *(in++);
} }
while (*in);
*out = '\0'; *out = '\0';
return (ptr); return ptr;
} }
int32_t OSD_Exec(const char *szScript) int32_t OSD_Exec(const char *szScript)

View file

@ -67,6 +67,7 @@ G_EXTERN char myjumpingtoggle,myonground,myhardlanding,myreturntocenter;
G_EXTERN char pus,pub; G_EXTERN char pus,pub;
G_EXTERN char ready2send; G_EXTERN char ready2send;
G_EXTERN char szPlayerName[32]; G_EXTERN char szPlayerName[32];
// XXX: menutextbuf overflow possible?
G_EXTERN char tempbuf[MAXSECTORS<<1],packbuf[PACKBUF_SIZE],menutextbuf[128],buf[1024]; G_EXTERN char tempbuf[MAXSECTORS<<1],packbuf[PACKBUF_SIZE],menutextbuf[128],buf[1024];
G_EXTERN char typebuflen,typebuf[141]; G_EXTERN char typebuflen,typebuf[141];
G_EXTERN input_t avg; G_EXTERN input_t avg;