raptor2/backport-0001-CVE-2024-57823.patch
张梁鹏堃 7b06de48e6 fix CVE-2024-57823
Signed-off-by: 张梁鹏堃 <zhangliangpengkun@xfusion.com>
(cherry picked from commit 3a04f82e5521df4a56619daca09f502a59501b44)
2025-04-18 20:23:41 +08:00

39 lines
1.2 KiB
Diff

From da7a79976bd0314c23cce55d22495e7d29301c44 Mon Sep 17 00:00:00 2001
From: Dave Beckett <dave@dajobe.org>
Date: Thu, 6 Feb 2025 21:12:37 -0800
Subject: [PATCH] Fix Github issue 70 A) Integer Underflow in
raptor_uri_normalize_path()
(raptor_uri_normalize_path): Return empty buffer if path gets to 0
length
---
src/raptor_rfc2396.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/raptor_rfc2396.c b/src/raptor_rfc2396.c
index 8cc364f4..f8ec5798 100644
--- a/src/raptor_rfc2396.c
+++ b/src/raptor_rfc2396.c
@@ -351,6 +351,10 @@ raptor_uri_normalize_path(unsigned char* path_buffer, size_t path_len)
*dest++ = *s++;
*dest = '\0';
path_len -= len;
+ if(path_len <= 0) {
+ *path_buffer = '\0';
+ return 0;
+ }
if(p && p < prev) {
/* We know the previous prev path component and we didn't do
@@ -390,6 +394,10 @@ raptor_uri_normalize_path(unsigned char* path_buffer, size_t path_len)
/* Remove <component>/.. at the end of the path */
*prev = '\0';
path_len -= (s-prev);
+ if(path_len <= 0) {
+ *path_buffer = '\0';
+ return 0;
+ }
}