From d5a1f0a0d4b4ec7a3a93f5f10da2f83c1db4af0c Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 4 May 2013 16:36:13 +0000 Subject: [PATCH] osd.c: Fix OSD_StripColors() with empty input string. git-svn-id: https://svn.eduke32.com/eduke32@3727 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/osd.c | 5 ++--- polymer/eduke32/source/global.h | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/polymer/eduke32/build/src/osd.c b/polymer/eduke32/build/src/osd.c index 523ac608f..c1d254dff 100644 --- a/polymer/eduke32/build/src/osd.c +++ b/polymer/eduke32/build/src/osd.c @@ -219,7 +219,7 @@ const char *OSD_StripColors(char *out, const char *in) { const char *ptr = out; - do + while (*in) { if (*in == '^' && isdigit(*(in+1))) { @@ -240,10 +240,9 @@ const char *OSD_StripColors(char *out, const char *in) } *(out++) = *(in++); } - while (*in); *out = '\0'; - return (ptr); + return ptr; } int32_t OSD_Exec(const char *szScript) diff --git a/polymer/eduke32/source/global.h b/polymer/eduke32/source/global.h index 8605e009d..c2f4a912a 100644 --- a/polymer/eduke32/source/global.h +++ b/polymer/eduke32/source/global.h @@ -67,6 +67,7 @@ G_EXTERN char myjumpingtoggle,myonground,myhardlanding,myreturntocenter; G_EXTERN char pus,pub; G_EXTERN char ready2send; 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 typebuflen,typebuf[141]; G_EXTERN input_t avg;