redis: Fix CVE-2025-27151

Upstream-Status: Backport from https://github.com/redis/redis/commit/d0eeee6e31f0fefb510007a8cfdf5dce729a8be9

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
This commit is contained in:
Vijay Anusuri
2025-10-16 15:40:14 +05:30
committed by Gyorgy Sarvari
parent aecae8eb07
commit 515f1f1e6e
2 changed files with 33 additions and 0 deletions
@@ -0,0 +1,32 @@
From d0eeee6e31f0fefb510007a8cfdf5dce729a8be9 Mon Sep 17 00:00:00 2001
From: YaacovHazan <yaacov.hazan@redis.com>
Date: Tue, 27 May 2025 10:23:27 +0300
Subject: [PATCH] Check length of AOF file name in redis-check-aof
(CVE-2025-27151)
Ensure that the length of the input file name does not exceed PATH_MAX
Upstream-Status: Backport [https://github.com/redis/redis/commit/d0eeee6e31f0fefb510007a8cfdf5dce729a8be9]
CVE: CVE-2025-27151
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
src/redis-check-aof.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/redis-check-aof.c b/src/redis-check-aof.c
index e28126df603..5b3ee2a48c5 100644
--- a/src/redis-check-aof.c
+++ b/src/redis-check-aof.c
@@ -547,6 +547,12 @@ int redis_check_aof_main(int argc, char **argv) {
goto invalid_args;
}
+ /* Check if filepath is longer than PATH_MAX */
+ if (strlen(filepath) > PATH_MAX) {
+ printf("Error: filepath is too long (exceeds PATH_MAX)\n");
+ goto invalid_args;
+ }
+
/* In the glibc implementation dirname may modify their argument. */
memcpy(temp_filepath, filepath, strlen(filepath) + 1);
dirpath = dirname(temp_filepath);
@@ -24,6 +24,7 @@ SRC_URI = "http://download.redis.io/releases/${BP}.tar.gz \
file://CVE-2024-46981.patch \
file://CVE-2024-51741.patch \
file://CVE-2025-21605.patch \
file://CVE-2025-27151.patch \
"
SRC_URI[sha256sum] = "97065774d5fb8388eb0d8913458decfcb167d356e40d31dd01cd30c1cc391673"