From e3ae896a861dde8e8427b49349fc28a7f768bcd7 Mon Sep 17 00:00:00 2001 From: "zhang.jiujiu" <282627424@qq.com> Date: Sat, 16 Sep 2023 13:06:47 +0200 Subject: [PATCH] Fix for CVE-2023-33460 https://github.com/lloyd/yajl/issues/250#issuecomment-1628695214 Origin: https://github.com/openEuler-BaseService/yajl/commit/23a122eddaa28165a6c219000adcc31ff9a8a698 https://github.com/openEuler-BaseService/yajl/commit/3d65cb0c6db4d433e5e42ee7d91d8a04e21337cf.patch Bug: https://github.com/lloyd/yajl/issues/250 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039984 --- src/cdogs/yajl/yajl_tree.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cdogs/yajl/yajl_tree.c b/src/cdogs/yajl/yajl_tree.c index 22e666cce..977a7bc1b 100644 --- a/src/cdogs/yajl/yajl_tree.c +++ b/src/cdogs/yajl/yajl_tree.c @@ -143,7 +143,7 @@ static yajl_val context_pop(context_t *ctx) ctx->stack = stack->next; v = stack->value; - + free (stack->key); free (stack); return (v); @@ -444,7 +444,14 @@ yajl_val yajl_tree_parse (const char *input, snprintf(error_buffer, error_buffer_size, "%s", internal_err_str); YA_FREE(&(handle->alloc), internal_err_str); } + while(ctx.stack != NULL) { + yajl_val v = context_pop(&ctx); + yajl_tree_free(v); + } yajl_free (handle); + //If the requested memory is not released in time, it will cause memory leakage + if(ctx.root) + yajl_tree_free(ctx.root); return NULL; }