attempt fix for bug #37596

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35716 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2012-10-18 21:44:50 +00:00
parent e02ff90f23
commit 9e2e614c11
2 changed files with 30 additions and 20 deletions

View file

@ -1,3 +1,7 @@
2012-10-18 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSXMLParser.m: Try to fix entity parsing bug #37596
2012-10-17 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSBundle.m:

View file

@ -1383,26 +1383,32 @@ NSLog(@"_processTag <%@%@ %@>", flag?@"/": @"", tag, attributes);
if (*ep == '#')
{
// &#ddd; or &#xhh;
// !!! ep+1 is not 0-terminated - but by ;!!
if (sscanf((char *)ep+1, "x%x;", &val))
{
// &#xhh; hex value
if (result != 0)
{
*result = [[NSString alloc] initWithFormat: @"%C", val];
}
return YES;
}
else if (sscanf((char *)ep+1, "%d;", &val))
{
// &ddd; decimal value
if (result != 0)
{
*result = [[NSString alloc] initWithFormat: @"%C", val];
}
return YES;
}
if (len < 8)
{
char buf[8];
memcpy(buf, ep + 1, len - 1);
buf[len - 1] = '\0';
// &#ddd; or &#xhh;
if (sscanf(buf, "x%x;", &val))
{
// &#xhh; hex value
if (result != 0)
{
*result = [[NSString alloc] initWithFormat: @"%C", val];
}
return YES;
}
else if (sscanf(buf, "%d;", &val))
{
// &ddd; decimal value
if (result != 0)
{
*result = [[NSString alloc] initWithFormat: @"%C", val];
}
return YES;
}
}
}
else
{