|
|
f1d1c0 |
From cc70f19e588a0a33ed86c4a059b56a8f5b0c7a82 Mon Sep 17 00:00:00 2001
|
|
|
f1d1c0 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
f1d1c0 |
Date: Mon, 27 Jan 2020 16:11:41 +0100
|
|
|
f1d1c0 |
Subject: [PATCH] netlink: Fix leak in unterminated string deserializer
|
|
|
f1d1c0 |
|
|
|
f1d1c0 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1793030
|
|
|
f1d1c0 |
Upstream Status: nftables commit c3f6be3f2dced
|
|
|
f1d1c0 |
|
|
|
f1d1c0 |
commit c3f6be3f2dcedf6d79751c0b975315ebc3184364
|
|
|
f1d1c0 |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
f1d1c0 |
Date: Mon Jan 20 13:52:10 2020 +0100
|
|
|
f1d1c0 |
|
|
|
f1d1c0 |
netlink: Fix leak in unterminated string deserializer
|
|
|
f1d1c0 |
|
|
|
f1d1c0 |
Allocated 'mask' expression is not freed before returning to caller,
|
|
|
f1d1c0 |
although it is used temporarily only.
|
|
|
f1d1c0 |
|
|
|
f1d1c0 |
Fixes: b851ba4731d9f ("src: add interface wildcard matching")
|
|
|
f1d1c0 |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
f1d1c0 |
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
f1d1c0 |
---
|
|
|
f1d1c0 |
src/netlink_delinearize.c | 6 ++++--
|
|
|
f1d1c0 |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
f1d1c0 |
|
|
|
f1d1c0 |
diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
|
|
|
f1d1c0 |
index 154353b..06a0312 100644
|
|
|
f1d1c0 |
--- a/src/netlink_delinearize.c
|
|
|
f1d1c0 |
+++ b/src/netlink_delinearize.c
|
|
|
f1d1c0 |
@@ -2030,7 +2030,7 @@ static bool __expr_postprocess_string(struct expr **exprp)
|
|
|
f1d1c0 |
|
|
|
f1d1c0 |
static struct expr *expr_postprocess_string(struct expr *expr)
|
|
|
f1d1c0 |
{
|
|
|
f1d1c0 |
- struct expr *mask;
|
|
|
f1d1c0 |
+ struct expr *mask, *out;
|
|
|
f1d1c0 |
|
|
|
f1d1c0 |
assert(expr_basetype(expr)->type == TYPE_STRING);
|
|
|
f1d1c0 |
if (__expr_postprocess_string(&expr))
|
|
|
f1d1c0 |
@@ -2040,7 +2040,9 @@ static struct expr *expr_postprocess_string(struct expr *expr)
|
|
|
f1d1c0 |
BYTEORDER_HOST_ENDIAN,
|
|
|
f1d1c0 |
expr->len + BITS_PER_BYTE, NULL);
|
|
|
f1d1c0 |
mpz_init_bitmask(mask->value, expr->len);
|
|
|
f1d1c0 |
- return string_wildcard_expr_alloc(&expr->location, mask, expr);
|
|
|
f1d1c0 |
+ out = string_wildcard_expr_alloc(&expr->location, mask, expr);
|
|
|
f1d1c0 |
+ expr_free(mask);
|
|
|
f1d1c0 |
+ return out;
|
|
|
f1d1c0 |
}
|
|
|
f1d1c0 |
|
|
|
f1d1c0 |
static void expr_postprocess(struct rule_pp_ctx *ctx, struct expr **exprp)
|
|
|
f1d1c0 |
--
|
|
|
bfbb76 |
2.31.1
|
|
|
f1d1c0 |
|