Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions KissXML/DDXMLDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ - (id)initWithXMLString:(NSString *)string options:(NSUInteger)mask error:(NSErr
**/
- (id)initWithData:(NSData *)data options:(NSUInteger)mask error:(NSError **)error
{
if (data == nil || [data length] == 0)
if (data == nil || [data length] == 0 || [data length] > INT_MAX)
{
if (error) *error = [NSError errorWithDomain:@"DDXMLErrorDomain" code:0 userInfo:nil];

Expand All @@ -91,7 +91,7 @@ - (id)initWithData:(NSData *)data options:(NSUInteger)mask error:(NSError **)err
// Therefore, we call it again here just to be safe.
xmlKeepBlanksDefault(0);

xmlDocPtr doc = xmlParseMemory([data bytes], [data length]);
xmlDocPtr doc = xmlParseMemory([data bytes], (int)[data length]);
if (doc == NULL)
{
if (error) *error = [NSError errorWithDomain:@"DDXMLErrorDomain" code:1 userInfo:nil];
Expand Down
6 changes: 3 additions & 3 deletions KissXML/DDXMLElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@ - (NSArray *)elementsForLocalName:(NSString *)localName URI:(NSString *)uri
}
else
{
NSString *prefix;
NSString *anotherPrefix;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check PR #61: we don't need to declare an another variable here.

NSString *realLocalName;

[DDXMLNode getPrefix:&prefix localName:&realLocalName forName:localName];
[DDXMLNode getPrefix:&anotherPrefix localName:&realLocalName forName:localName];

return [self _elementsForName:localName localName:realLocalName prefix:prefix uri:uri];
return [self _elementsForName:localName localName:realLocalName prefix:anotherPrefix uri:uri];
}
}

Expand Down