Blame SOURCES/0010-hash-Fix-potential-null-pointer-dereference-in-hash_.patch

ba04b3
From 76a8ca39b3f95b898cd92546fb87ccaa2d1922c7 Mon Sep 17 00:00:00 2001
ba04b3
From: Phil Sutter <psutter@redhat.com>
ba04b3
Date: Wed, 20 Jun 2018 09:22:47 +0200
ba04b3
Subject: [PATCH] hash: Fix potential null-pointer dereference in
ba04b3
 hash_expr_cmp()
ba04b3
ba04b3
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1504157
ba04b3
Upstream Status: nftables commit 5043a1e4847c0
ba04b3
ba04b3
commit 5043a1e4847c0149dabaf0b529a14a43b957e5e4
ba04b3
Author: Phil Sutter <phil@nwl.cc>
ba04b3
Date:   Thu Mar 1 15:00:30 2018 +0100
ba04b3
ba04b3
    hash: Fix potential null-pointer dereference in hash_expr_cmp()
ba04b3
ba04b3
    The first part of the conditional:
ba04b3
ba04b3
    | (e1->hash.expr || expr_cmp(e1->hash.expr, e2->hash.expr))
ba04b3
ba04b3
    will call expr_cmp() in case e1->hash.expr is NULL, causing null-pointer
ba04b3
    dereference. This is probably a typo, the intention when introducing
ba04b3
    this was to avoid the call to expr_cmp() for symmetric hash expressions
ba04b3
    which don't use expr->hash.expr. Inverting the existence check should
ba04b3
    fix this.
ba04b3
ba04b3
    Fixes: 3a86406729782 ("src: hash: support of symmetric hash")
ba04b3
    Cc: Laura Garcia Liebana <nevola@gmail.com>
ba04b3
    Signed-off-by: Phil Sutter <phil@nwl.cc>
ba04b3
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
ba04b3
---
ba04b3
 src/hash.c | 2 +-
ba04b3
 1 file changed, 1 insertion(+), 1 deletion(-)
ba04b3
ba04b3
diff --git a/src/hash.c b/src/hash.c
ba04b3
index 3355cad..e699963 100644
ba04b3
--- a/src/hash.c
ba04b3
+++ b/src/hash.c
ba04b3
@@ -36,7 +36,7 @@ static void hash_expr_print(const struct expr *expr, struct output_ctx *octx)
ba04b3
 
ba04b3
 static bool hash_expr_cmp(const struct expr *e1, const struct expr *e2)
ba04b3
 {
ba04b3
-	return (e1->hash.expr ||
ba04b3
+	return (!e1->hash.expr ||
ba04b3
 		expr_cmp(e1->hash.expr, e2->hash.expr)) &&
ba04b3
 	       e1->hash.mod == e2->hash.mod &&
ba04b3
 	       e1->hash.seed_set == e2->hash.seed_set &&
ba04b3
-- 
ba04b3
1.8.3.1
ba04b3