Skip to content
This repository was archived by the owner on Jun 13, 2018. It is now read-only.

Commit ecc55b4

Browse files
authored
Merge pull request #133 from Sekenre/master
Problem: Error processing CDATA tags
2 parents e99d3f9 + cf132a7 commit ecc55b4

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/sflxmll.c

+29
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,35 @@ xml_load_item (XML_ITEM *item, XML_BUFFER *buf)
14181418
}
14191419
buf_next (buf);
14201420
}
1421+
else if (c == '[')
1422+
{
1423+
item_name = buf_get_name (buf);
1424+
if (!item_name || !strcmp (item_name, "CDATA"))
1425+
{
1426+
set_error (buf, "'--' or [CDATA[ declaration expected");
1427+
return XML_LOADERROR;
1428+
}
1429+
mem_free (item_name);
1430+
/* It is a CDATA element. Skip everything until the next occurence
1431+
* of ']]>'
1432+
*/
1433+
found = FALSE;
1434+
while (!found)
1435+
{
1436+
buf_next(buf);
1437+
CHECK_BUF_STATE_AND_BREAK_ON_ERROR(3); /* ']]>' expected */
1438+
comment = buf_get_until_gt(buf);
1439+
CHECK_BUF_STATE_AND_BREAK_ON_ERROR(3);
1440+
ASSERT (comment);
1441+
size = strlen(comment);
1442+
found = ((size >= 2)
1443+
&& (comment[size-1] == ']')
1444+
&& (comment[size-2] == ']')) ? TRUE : FALSE;
1445+
mem_free (comment);
1446+
}
1447+
if (found)
1448+
buf_next(buf);
1449+
}
14211450
else
14221451
{
14231452
set_error (buf, "'--' or DOCTYPE declaration expected");

0 commit comments

Comments
 (0)