zlog: patch CVE-2024-22857

Details: https://nvd.nist.gov/vuln/detail/CVE-2024-22857

Pick the patch from the PR mentioned by the nvd report.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
This commit is contained in:
Gyorgy Sarvari
2025-12-13 21:18:18 +01:00
parent 4437919060
commit d9fbd8560e
2 changed files with 32 additions and 0 deletions
@@ -0,0 +1,31 @@
From 68c712b401538abc3028ecc5071fa787f87afa7f Mon Sep 17 00:00:00 2001
From: Ali Raza <elirazamumtaz@gmail.com>
Date: Thu, 29 Feb 2024 11:36:25 +0500
Subject: [PATCH] buffer overflow patched (#251)
Thank you for the PR
CVE: CVE-2024-22857
Upstream-Status: Backport [https://github.com/HardySimpson/zlog/commit/c47f781a9f1e9604f5201e27d046d925d0d48ac4]
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
src/rule.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/rule.c b/src/rule.c
index ae3d74f..38d3fdc 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -866,8 +866,10 @@ zlog_rule_t *zlog_rule_new(char *line,
}
break;
case '$' :
- sscanf(file_path + 1, "%s", a_rule->record_name);
-
+ // read only MAXLEN_PATH characters from the file_path + 1
+ strncpy(a_rule->record_name, file_path + 1, MAXLEN_PATH);
+ a_rule->record_name[MAXLEN_PATH] = '\0';
+
if (file_limit) { /* record path exists */
p = strchr(file_limit, '"');
if (!p) {
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
SRCREV = "876099f3c66033f3de11d79f63814766b1021dbe"
SRC_URI = "git://github.com/HardySimpson/zlog;branch=master;protocol=https \
file://0001-Fix-stack-buffer-overflow-at-zlog_conf_build_with_fi.patch \
file://CVE-2024-22857.patch \
"
S = "${WORKDIR}/git"