aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2016-03-16 19:49:28 (GMT)
committerJouni Malinen <j@w1.fi>2016-03-16 19:49:28 (GMT)
commit64ce5905f85fc9db2ff66e1d2e0e0355092ced02 (patch)
tree15d2ec3ac1d2974be4b5e16ab52b3fd88d4c576a /src/utils
parent8b827c342f07b01622079734b24f8bf65497a1d6 (diff)
downloadhostap-64ce5905f85fc9db2ff66e1d2e0e0355092ced02.zip
hostap-64ce5905f85fc9db2ff66e1d2e0e0355092ced02.tar.gz
hostap-64ce5905f85fc9db2ff66e1d2e0e0355092ced02.tar.bz2
libxml2: Check for xmlDocDumpFormatMemory() error case
Since this function needs to allocate memory, it might fail. Check that the returned memory pointer is not NULL before trying to parse the output. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/xml_libxml2.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/utils/xml_libxml2.c b/src/utils/xml_libxml2.c
index c928394..7b6d276 100644
--- a/src/utils/xml_libxml2.c
+++ b/src/utils/xml_libxml2.c
@@ -212,6 +212,8 @@ char * xml_node_to_str(struct xml_node_ctx *ctx, xml_node_t *node)
xmlDocSetRootElement(doc, n);
xmlDocDumpFormatMemory(doc, &buf, &bufsiz, 0);
xmlFreeDoc(doc);
+ if (!buf)
+ return NULL;
pos = (char *) buf;
if (strncmp(pos, "<?xml", 5) == 0) {
pos = strchr(pos, '>');