From 9b616a08df3613bf27473d176b1b72cd671b75a5 Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Thu, 8 Mar 2012 16:04:56 +0100 Subject: [PATCH] Removing access to NULL pointers in node.c and element.c Check that newNode is not NULL ixmlNode_cloneNodeTree and pass newAttr as the return node in the ixmlElement_setAttributeNodeNS call of ixmlElement_setAttributeNS. --- ChangeLog | 8 ++++++++ ixml/src/element.c | 2 +- ixml/src/node.c | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07866ce..2d8dc9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,14 @@ Version 1.6.16 ******************************************************************************* +2012-03-08 Fabrice Fontaine + + Removing access to NULL pointers in node.c and element.c + + Check that newNode is not NULL ixmlNode_cloneNodeTree and pass newAttr + as the return node in the ixmlElement_setAttributeNodeNS call of + ixmlElement_setAttributeNS. + 2012-03-08 Fabrice Fontaine Memory leaks correction in upnpapi.c diff --git a/ixml/src/element.c b/ixml/src/element.c index 1f8c9e4..2641b7d 100644 --- a/ixml/src/element.c +++ b/ixml/src/element.c @@ -487,7 +487,7 @@ int ixmlElement_setAttributeNS( Parser_freeNodeContent(&newAttrNode); return IXML_INSUFFICIENT_MEMORY; } - if (ixmlElement_setAttributeNodeNS(element, newAttr, NULL) != IXML_SUCCESS) { + if (ixmlElement_setAttributeNodeNS(element, newAttr, &newAttr) != IXML_SUCCESS) { ixmlAttr_free(newAttr); Parser_freeNodeContent(&newAttrNode); return IXML_FAILED; diff --git a/ixml/src/node.c b/ixml/src/node.c index d59d25e..1b64aa0 100644 --- a/ixml/src/node.c +++ b/ixml/src/node.c @@ -1040,7 +1040,8 @@ static IXML_Node *ixmlNode_cloneNodeTree( } /* by spec, the duplicate node has no parent */ - newNode->parentNode = NULL; + if (newNode != NULL) + newNode->parentNode = NULL; return newNode; }