From 998c9dc57412af33b1643134bba302cfb6d5b895 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 7 Jul 2007 18:46:40 +0000 Subject: [PATCH] fixed a bug where too many hex digits were read for \x --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401057 --- sourcepawn/compiler/sc2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sourcepawn/compiler/sc2.c b/sourcepawn/compiler/sc2.c index d75e5222..7db6e7fa 100644 --- a/sourcepawn/compiler/sc2.c +++ b/sourcepawn/compiler/sc2.c @@ -2329,18 +2329,22 @@ static cell litchar(const unsigned char **lptr,int flags) cptr+=1; break; case 'x': + { + int digits = 0; cptr+=1; c=0; - while (ishex(*cptr)) { + while (ishex(*cptr) && digits < 2) { if (isdigit(*cptr)) c=(c<<4)+(*cptr-'0'); else c=(c<<4)+(tolower(*cptr)-'a'+10); cptr++; + digits++; } /* while */ if (*cptr==';') cptr++; /* swallow a trailing ';' */ break; + } case '\'': /* \' == ' (single quote) */ case '"': /* \" == " (single quote) */ case '%': /* \% == % (percent) */