Fixed endless loop in mxml_decode if a comment contained an entity like &XYZ;

This commit is contained in:
Stefan Ritt 2007-04-04 13:32:24 +00:00
parent dabfe6db7c
commit fdfe3d2413

11
mxml.c
View File

@ -286,22 +286,25 @@ void mxml_decode(char *str)
*(p++) = '<'; *(p++) = '<';
strcpy(p, p+3); strcpy(p, p+3);
} }
if (strncmp(p, "&gt;", 4) == 0) { else if (strncmp(p, "&gt;", 4) == 0) {
*(p++) = '>'; *(p++) = '>';
strcpy(p, p+3); strcpy(p, p+3);
} }
if (strncmp(p, "&amp;", 5) == 0) { else if (strncmp(p, "&amp;", 5) == 0) {
*(p++) = '&'; *(p++) = '&';
strcpy(p, p+4); strcpy(p, p+4);
} }
if (strncmp(p, "&quot;", 6) == 0) { else if (strncmp(p, "&quot;", 6) == 0) {
*(p++) = '\"'; *(p++) = '\"';
strcpy(p, p+5); strcpy(p, p+5);
} }
if (strncmp(p, "&apos;", 6) == 0) { else if (strncmp(p, "&apos;", 6) == 0) {
*(p++) = '\''; *(p++) = '\'';
strcpy(p, p+5); strcpy(p, p+5);
} }
else {
p++; // skip unknown entity
}
} }
/* if (str[0] == '\"' && str[strlen(str)-1] == '\"') { /* if (str[0] == '\"' && str[strlen(str)-1] == '\"') {
strcpy(str, str+1); strcpy(str, str+1);