From Hal_Burch@gs10.sp.cs.cmu.edu  Sun Apr 18 05:18:02 2004
Return-Path: <Hal_Burch@gs10.sp.cs.cmu.edu>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 28A5416A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 18 Apr 2004 05:18:02 -0700 (PDT)
Received: from gs10.sp.cs.cmu.edu (GS10.SP.CS.CMU.EDU [128.2.198.127])
	by mx1.FreeBSD.org (Postfix) with SMTP id C496D43D54
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 18 Apr 2004 05:18:01 -0700 (PDT)
	(envelope-from Hal_Burch@gs10.sp.cs.cmu.edu)
Received: from gs10.sp.cs.cmu.edu ([127.0.0.1]) by gs10.sp.cs.cmu.edu
          id aa30281; 18 Apr 2004 8:17 EDT
Message-Id: <20040418121801.C496D43D54@mx1.FreeBSD.org>
Date: Sun, 18 Apr 2004 08:17:24 -0400
From: Hal Burch <Hal_Burch@gs10.sp.cs.cmu.edu>
Reply-To: hburch+@cs.cmu.edu
To: FreeBSD-gnats-submit@freebsd.org
Subject: scp does not deal with local file copies with spaces
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         65707
>Category:       bin
>Synopsis:       scp does not deal with local file copies with spaces
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 18 05:20:07 PDT 2004
>Closed-Date:    Thu Feb 14 07:30:59 UTC 2008
>Last-Modified:  Thu Feb 14 07:30:59 UTC 2008
>Originator:     Hal Burch
>Release:        FreeBSD 4.9-RC i386
>Organization:
>Environment:
System: FreeBSD hburch-lap.hburch.com 4.9-RC FreeBSD 4.9-RC #24: Fri Dec 26 11:16:36 EST 2003 hburch@hburch-lap.hburch.com:/usr/src/sys/compile/LOCAL i386

$ ssh -V
OpenSSH_3.5p1 FreeBSD-20030201, SSH protocols 1.5/2.0, OpenSSL 0x0090701f
>Description:
If you scp a list of local files to a local directory, scp execs cp
to do its work.  If a filename has spaces in it, this process converts them
to separate filenames.

I was concerned about this being a possible security problem if you had
filenames with backspace characters or newlines.  After looking at the
code and testing some examples, this does not appear to be a problem.

However, this could cause unintended consequences (copy a different
file than expected).
>How-To-Repeat:
hburch-lap:~ $ mkdir tdir
hburch-lap:~ $ cd tdir
hburch-lap:~/tdir $ touch "a b"
hburch-lap:~/tdir $ scp * /tmp
cp: b: No such file or directory
cp: a: No such file or directory

Not certain what is going on here, though:
hburch-lap:~/tdir $ touch 'c
> d'
hburch-lap:~/tdir $ scp * /tmp
cp: b: No such file or directory
cp: a: No such file or directory
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
       cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
>Fix:
tolocal() execs cp for each argument by itself.  This may be as simple
as adding double quotes around the argv[i] %s, but I did not test that.
>Release-Note:
>Audit-Trail:

From: Kris Kennaway <kris@obsecurity.org>
To: hburch+@cs.cmu.edu
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: bin/65707: scp does not deal with local file copies with spaces
Date: Sun, 18 Apr 2004 17:07:56 -0700

 --PEIAKu/WMn1b1Hv9
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Sun, Apr 18, 2004 at 08:17:24AM -0400, Hal Burch wrote:
 
 > If you scp a list of local files to a local directory, scp execs cp
 > to do its work.  If a filename has spaces in it, this process converts them
 > to separate filenames.
 
 You should take up this bug report with the OpenSSH developers.
 FreeBSD does not separately maintain this software.
 
 Kris
 
 --PEIAKu/WMn1b1Hv9
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.4 (FreeBSD)
 
 iD8DBQFAgxhcWry0BWjoQKURAtCLAJ9V32YlP4aceS2axXAEHG8UesxmUACgivUH
 o72UfYV4Vgah9s8DbEOeZak=
 =iKOd
 -----END PGP SIGNATURE-----
 
 --PEIAKu/WMn1b1Hv9--
State-Changed-From-To: open->feedback 
State-Changed-By: antoine 
State-Changed-When: Sun Feb 10 18:28:02 UTC 2008 
State-Changed-Why:  
I can't reproduce this problem on recent releases. 
Can you confirm the problem no longer exists on recent releases ? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=65707 

From: Volker <volker@vwsoft.com>
To: bug-followup@FreeBSD.org, hburch+@cs.cmu.edu
Cc:  
Subject: Re: bin/65707: scp does not deal with local file copies with spaces
Date: Thu, 14 Feb 2008 00:50:47 +0100

 I see correct behavior on 6.2-RELEASE and 7.0
 
 IMHO this PR can be closed.
State-Changed-From-To: feedback->closed 
State-Changed-By: remko 
State-Changed-When: Thu Feb 14 07:30:58 UTC 2008 
State-Changed-Why:  
Volker sees correct behaviour, close the ticket. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=65707 
>Unformatted:
