* [PATCH nft] libnftables: fix crash when freeing non-malloc'd address
@ 2024-07-10 13:31 Florian Westphal
2024-07-10 14:01 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2024-07-10 13:31 UTC (permalink / raw)
To: netfilter-devel; +Cc: Florian Westphal
dirname may return static pointer:
munmap_chunk(): invalid pointer
20508 Aborted nft -f test
Fixes: 6ef04f99382c ("libnftables: search for default include path last")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
src/libnftables.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/libnftables.c b/src/libnftables.c
index af4734c05004..586f8fdede76 100644
--- a/src/libnftables.c
+++ b/src/libnftables.c
@@ -789,12 +789,12 @@ static int nft_run_optimized_file(struct nft_ctx *nft, const char *filename)
static int nft_ctx_add_basedir_include_path(struct nft_ctx *nft,
const char *filename)
{
- const char *basedir = dirname(xstrdup(filename));
+ char *basedir = xstrdup(filename);
int ret;
- ret = nft_ctx_add_include_path(nft, basedir);
+ ret = nft_ctx_add_include_path(nft, dirname(basedir));
- free_const(basedir);
+ free(basedir);
return ret;
}
--
2.44.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-10 14:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-10 13:31 [PATCH nft] libnftables: fix crash when freeing non-malloc'd address Florian Westphal
2024-07-10 14:01 ` Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.