From fdfe3d2413af56832044a423df203fb39c6ba6a9 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Wed, 4 Apr 2007 13:32:24 +0000 Subject: [PATCH] Fixed endless loop in mxml_decode if a comment contained an entity like &XYZ; --- mxml.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mxml.c b/mxml.c index 509bdee..81d7590 100755 --- a/mxml.c +++ b/mxml.c @@ -286,22 +286,25 @@ void mxml_decode(char *str) *(p++) = '<'; strcpy(p, p+3); } - if (strncmp(p, ">", 4) == 0) { + else if (strncmp(p, ">", 4) == 0) { *(p++) = '>'; strcpy(p, p+3); } - if (strncmp(p, "&", 5) == 0) { + else if (strncmp(p, "&", 5) == 0) { *(p++) = '&'; strcpy(p, p+4); } - if (strncmp(p, """, 6) == 0) { + else if (strncmp(p, """, 6) == 0) { *(p++) = '\"'; strcpy(p, p+5); } - if (strncmp(p, "'", 6) == 0) { + else if (strncmp(p, "'", 6) == 0) { *(p++) = '\''; strcpy(p, p+5); } + else { + p++; // skip unknown entity + } } /* if (str[0] == '\"' && str[strlen(str)-1] == '\"') { strcpy(str, str+1);