9 Star 1 Fork 29

src-openEuler/iptables

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-libxtables-Fix-memleak-of-matches-udata.patch 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
Venland 提交于 2024-06-25 10:47 . backport upstream patch
From e7366db80740d34d2fe4ba8d12ef86a423e66280 Mon Sep 17 00:00:00 2001
From: Phil Sutter <phil@nwl.cc>
Date: Wed, 31 Jan 2024 14:58:17 +0100
Subject: [PATCH] libxtables: Fix memleak of matches' udata
If the extension specifies a non-zero udata_size, field 'udata' points
to an allocated buffer which needs to be freed upon extension deinit.
Interestingly, this bug was identified by ASAN and missed by valgrind.
Fixes: 2dba676b68ef8 ("extensions: support for per-extension instance "global" variable space")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
libxtables/xtables.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libxtables/xtables.c b/libxtables/xtables.c
index b4339e8d..856bfae8 100644
--- a/libxtables/xtables.c
+++ b/libxtables/xtables.c
@@ -1420,6 +1420,10 @@ void xtables_rule_matches_free(struct xtables_rule_match **matches)
free(matchp->match->m);
matchp->match->m = NULL;
}
+ if (matchp->match->udata_size) {
+ free(matchp->match->udata);
+ matchp->match->udata = NULL;
+ }
if (matchp->match == matchp->match->next) {
free(matchp->match);
matchp->match = NULL;
--
2.43.4
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/iptables.git
git@gitee.com:src-openeuler/iptables.git
src-openeuler
iptables
iptables
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385