File: scp-quoting.patch

package info (click to toggle)
openssh 1%3A10.2p1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,552 kB
  • sloc: ansic: 134,025; sh: 15,814; makefile: 1,726; cpp: 773; awk: 341; pascal: 84; csh: 1
file content (44 lines) | stat: -rw-r--r-- 1,208 bytes parent folder | download
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
34
35
36
37
38
39
40
41
42
43
44
From 3e7b1288a43ecaaffc38925ae4c12cbeb1e56b1e Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@debian.org>
Date: Tue, 2 Dec 2025 10:29:10 +0000
Subject: scp: Quote filenames in verbose mode

This is less misleading if there are any shell metacharacters.

Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=3900
Bug-Ubuntu: https://bugs.launchpad.net/bugs/89945
Forwarded: https://bugzilla.mindrot.org/show_bug.cgi?id=3900
Last-Update: 2025-12-02

Patch-Name: scp-quoting.patch
---
 scp.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/scp.c b/scp.c
index c5f573cc1..e141362c6 100644
--- a/scp.c
+++ b/scp.c
@@ -216,7 +216,7 @@ suspchild(int signo)
 static int
 do_local_cmd(arglist *a)
 {
-	u_int i;
+	char *args;
 	int status;
 	pid_t pid;
 
@@ -224,10 +224,9 @@ do_local_cmd(arglist *a)
 		fatal("do_local_cmd: no arguments");
 
 	if (verbose_mode) {
-		fprintf(stderr, "Executing:");
-		for (i = 0; i < a->num; i++)
-			fmprintf(stderr, " %s", a->list[i]);
-		fprintf(stderr, "\n");
+		args = argv_assemble(a->num, a->list);
+		fmprintf(stderr, "Executing: %s\n", args);
+		free(args);
 	}
 	if ((pid = fork()) == -1)
 		fatal("do_local_cmd: fork: %s", strerror(errno));