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:
rfm 2012-10-18 21:44:50 +00:00
parent fcd6be710e
commit 4d2e285422
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> 2012-10-17 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSBundle.m: * Source/NSBundle.m:

View file

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