summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/curl/curl/CVE-2023-27534.patch
blob: 3ecd18129039829520d2d59c6aee6790752ee4cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 4e2b52b5f7a3bf50a0f1494155717b02cc1df6d6 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Thu, 9 Mar 2023 16:22:11 +0100
Subject: [PATCH] curl_path: create the new path with dynbuf

Closes #10729

CVE: CVE-2023-27534
Note: This patch is needed to backport CVE-2023-27534
Upstream-Status: Backport from [https://github.com/curl/curl/commit/4e2b52b5f7a3bf50a0f1494155717b02cc1df6d6]

Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
 lib/curl_path.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/curl_path.c b/lib/curl_path.c
index 40b92ee..598c5dd 100644
--- a/lib/curl_path.c
+++ b/lib/curl_path.c
@@ -60,7 +60,7 @@ CURLcode Curl_getworkingpath(struct connectdata *conn,
       memcpy(real_path, working_path, 1 + working_path_len);
   }
   else if(conn->handler->protocol & CURLPROTO_SFTP) {
-    if((working_path_len > 1) && (working_path[1] == '~')) {
+    if((working_path_len > 2) && !memcmp(working_path, "/~/", 3)) {
       size_t homelen = strlen(homedir);
       real_path = malloc(homelen + working_path_len + 1);
       if(real_path == NULL) {
-- 
2.24.4