summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJohn Ellis <johne@verizon.net>2010-06-26 04:58:46 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:38 +0000
commit9c039b14c975dee425c057d284d9c1cf2c3d3bac (patch)
tree3ab6b389c18508ac6326b9e63f1d853b4d6113f2 /src/ui
parentea89f238e56b20f374d98be21c1ef420f251c960 (diff)
fix emoticon parser from allowing a partial match
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/ui_shared.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c
index 3b3466db..f36c7b9b 100644
--- a/src/ui/ui_shared.c
+++ b/src/ui/ui_shared.c
@@ -1881,6 +1881,7 @@ qboolean UI_Text_IsEmoticon( const char *s, qboolean *escaped,
int *length, qhandle_t *h, int *width )
{
const char *p = s;
+ char emoticon[ MAX_EMOTICON_NAME_LEN ];
int i;
if( *p != '[' )
@@ -1896,11 +1897,16 @@ qboolean UI_Text_IsEmoticon( const char *s, qboolean *escaped,
*escaped = qfalse;
for( *length = 0; p[ *length ] != ']'; ( *length )++ )
- if( !p[ *length ] )
+ {
+ if( !p[ *length ] || *length == MAX_EMOTICON_NAME_LEN - 1 )
return qfalse;
+ emoticon[ *length ] = p[ *length ];
+ }
+ emoticon[ *length ] = '\0';
+
for( i = 0; i < DC->Assets.emoticonCount; i++ )
- if( !Q_stricmpn( DC->Assets.emoticons[ i ].name, p, *length ) )
+ if( !Q_stricmp( DC->Assets.emoticons[ i ].name, emoticon ) )
break;
if( i == DC->Assets.emoticonCount )