From f57644702ddc427dfafc728fb25085158e93504a Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 25 Jul 2013 21:58:33 +0200 Subject: mxml: nft_mxml_str_parse returns copy of the string Otherwise, the string points to an invalid memory position somewhere in the XML tree that is released after the parsing. This problem was there before the conversion to the new helper function nft_mxml_str_parse. Reported-by: Arturo Borrero Signed-off-by: Pablo Neira Ayuso --- src/expr/log.c | 2 +- src/mxml.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/expr/log.c b/src/expr/log.c index 0872ee0..be2b40e 100644 --- a/src/expr/log.c +++ b/src/expr/log.c @@ -162,7 +162,7 @@ static int nft_rule_expr_log_xml_parse(struct nft_rule_expr *e, mxml_node_t *tre if (prefix == NULL) return -1; - log->prefix = strdup(prefix); + log->prefix = (char *)prefix; e->flags |= (1 << NFT_EXPR_LOG_PREFIX); if (nft_mxml_num_parse(tree, "group", MXML_DESCEND_FIRST, BASE_DEC, diff --git a/src/mxml.c b/src/mxml.c index e8d4b86..f812bf6 100644 --- a/src/mxml.c +++ b/src/mxml.c @@ -162,7 +162,7 @@ const char *nft_mxml_str_parse(mxml_node_t *tree, const char *node_name, return NULL; } - return node->child->value.opaque; + return strdup(node->child->value.opaque); } #endif -- cgit v1.2.3