Patchwork [libnftables] expr: bitwise: xml_parse: fix casting

login
register
mail settings
Submitter Arturo Borrero
Date June 15, 2013, 12:36 a.m.
Message ID <20130615003613.27171.26876.stgit@nfdev.cica.es>
Download mbox | patch
Permalink /patch/251564/
State Accepted
Delegated to: Pablo Neira
Headers show

Comments

Arturo Borrero - June 15, 2013, 12:36 a.m.
Not calling e->data when doing the casting causes memory corruption: segfault.

This was introduced at: 51370f0eedb1c8167ab2c340d2a53f0d9f02509c (src: add support for XML parsing)

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---
 src/expr/bitwise.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pablo Neira - June 17, 2013, 7:20 p.m.
On Sat, Jun 15, 2013 at 02:36:13AM +0200, Arturo Borrero wrote:
> Not calling e->data when doing the casting causes memory corruption: segfault.
> 
> This was introduced at: 51370f0eedb1c8167ab2c340d2a53f0d9f02509c (src: add support for XML parsing)

Please, next time use the short commit ID that you can get via
git log --oneline.

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/src/expr/bitwise.c b/src/expr/bitwise.c
index 9ebe3dc..1429483 100644
--- a/src/expr/bitwise.c
+++ b/src/expr/bitwise.c
@@ -200,7 +200,7 @@  static int
 nft_rule_expr_bitwise_xml_parse(struct nft_rule_expr *e, char *xml)
 {
 #ifdef XML_PARSING
-	struct nft_expr_bitwise *bitwise = (struct nft_expr_bitwise *)e;
+	struct nft_expr_bitwise *bitwise = (struct nft_expr_bitwise *)e->data;
 	mxml_node_t *tree = NULL;
 	mxml_node_t *node = NULL;
 	mxml_node_t *save = NULL;