curl_path: make SFTP handle a path like /~ properly.
authorCarlos Henrique Lima Melara <charlesmelara@riseup.net>
Thu, 5 Jun 2025 12:29:06 +0000 (14:29 +0200)
committerSamuel Henrique <samueloph@debian.org>
Sat, 19 Jul 2025 19:04:59 +0000 (21:04 +0200)
... without a trailing slash.

Fixes #17534
Closes #17542

Origin: upstream, https://github.com/curl/curl/commit/0ede81dcc61844cecce8904fb4de24319afeb024
Bug: https://github.com/curl/curl/issues/17534
Last-Update: 2025-06-09

Gbp-Pq: Name fix-CVE-2023-27534-regression-2.patch

lib/curl_path.c

index b4b48fe86ffb8b2c5dceb98ccc0d8e46062044e1..db66fb02ad8f326dd3fd51939e31243364969620 100644 (file)
@@ -84,6 +84,12 @@ CURLcode Curl_getworkingpath(struct Curl_easy *data,
         return CURLE_OUT_OF_MEMORY;
       }
     }
+    else {
+      if(Curl_dyn_add(&npath, "/")) {
+        free(working_path);
+        return CURLE_OUT_OF_MEMORY;
+      }
+    }
   }
 
   if(Curl_dyn_len(&npath)) {