Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding proper safety checks when printing xml.

  • Loading branch information...
commit 406159c1631fc04bd5c578b9d8ea72659c59fad4 1 parent 34ed84e
@robbiehanson authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 KissXML/DDXMLNode.m
View
11 KissXML/DDXMLNode.m
@@ -1065,11 +1065,18 @@ - (NSString *)XMLStringWithOptions:(NSUInteger)options
xmlIndentTreeOutput = 1;
}
+ int dumpCnt;
+
xmlBufferPtr bufferPtr = xmlBufferCreate();
if (IsXmlNsPtr(genericPtr))
- xmlNodeDump(bufferPtr, NULL, (xmlNodePtr)genericPtr, 0, format);
+ dumpCnt = xmlNodeDump(bufferPtr, NULL, (xmlNodePtr)genericPtr, 0, format);
else
- xmlNodeDump(bufferPtr, ((xmlStdPtr)genericPtr)->doc, (xmlNodePtr)genericPtr, 0, format);
+ dumpCnt = xmlNodeDump(bufferPtr, ((xmlStdPtr)genericPtr)->doc, (xmlNodePtr)genericPtr, 0, format);
+
+ if (dumpCnt < 0)
+ {
+ return nil;
+ }
if ([self kind] == DDXMLTextKind)
{
Please sign in to comment.
Something went wrong with that request. Please try again.