From 9297ac29af91324e3f94580b8ffc2a40a4d59e98 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Fri, 11 Feb 2022 12:26:05 -0800 Subject: [PATCH 1/2] Bug #702 fix double free in Juniper DLT --- docs/CHANGELOG | 1 + src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 968b0675..11f60552 100644 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -3,6 +3,7 @@ - build failures Debian/kfreebsd (#706) - bus error when building on armhf (#705) - typo fixes (#704) + - double free in Juniper DLT (#702) 01/31/2022 Version 4.4.0 - remove obsolete FORCE_ALIGN support to fix macOS 11 compile (#695) diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c index b7d05cdb..b0280560 100644 --- a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c +++ b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c @@ -168,7 +168,6 @@ dlt_jnpr_ether_cleanup(tcpeditdlt_t *ctx) config = (jnpr_ether_config_t *)ctx->encoder->config; tcpedit_dlt_cleanup(config->subctx); - safe_free(config->subctx); safe_free(plugin->config); plugin->config = NULL; plugin->config_size = 0; From 45cb2ac23213861749d82ad3524f46e347d308a3 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Fri, 11 Feb 2022 13:28:20 -0800 Subject: [PATCH 2/2] Bug #702 prevent double init in Juniper DLT --- src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c index b0280560..e282ef48 100644 --- a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c +++ b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c @@ -138,7 +138,8 @@ dlt_jnpr_ether_post_init(tcpeditdlt_t *ctx) /* init our subcontext & decoder of en10mb */ config = (jnpr_ether_config_t *)ctx->encoder->config; - config->subctx = tcpedit_dlt_init(ctx->tcpedit, DLT_EN10MB); + if (config->subctx == NULL) + config->subctx = tcpedit_dlt_init(ctx->tcpedit, DLT_EN10MB); return TCPEDIT_OK; }