mirror of
git://anongit.mindrot.org/openssh.git
synced 2025-02-18 14:56:55 +00:00
- dtucker@cvs.openbsd.org 2012/09/21 10:53:07
[sftp.c] Fix improper handling of absolute paths when PWD is part of the completed path. Patch from Jean-Marc Robert via tech@, ok djm.
This commit is contained in:
parent
063018d9f6
commit
191fcc6e4e
@ -10,6 +10,10 @@
|
||||
[sftp.c]
|
||||
Add bounds check on sftp tab-completion. Part of a patch from from
|
||||
Jean-Marc Robert via tech@, ok djm
|
||||
- dtucker@cvs.openbsd.org 2012/09/21 10:53:07
|
||||
[sftp.c]
|
||||
Fix improper handling of absolute paths when PWD is part of the completed
|
||||
path. Patch from Jean-Marc Robert via tech@, ok djm.
|
||||
|
||||
20120917
|
||||
- (dtucker) OpenBSD CVS Sync
|
||||
|
9
sftp.c
9
sftp.c
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: sftp.c,v 1.138 2012/09/18 10:36:12 dtucker Exp $ */
|
||||
/* $OpenBSD: sftp.c,v 1.139 2012/09/21 10:53:07 dtucker Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
|
||||
*
|
||||
@ -1699,7 +1699,7 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
|
||||
{
|
||||
glob_t g;
|
||||
char *tmp, *tmp2, ins[3];
|
||||
u_int i, hadglob, pwdlen, len, tmplen, filelen;
|
||||
u_int i, hadglob, pwdlen, len, tmplen, filelen, isabs;
|
||||
const LineInfo *lf;
|
||||
|
||||
/* Glob from "file" location */
|
||||
@ -1708,6 +1708,9 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
|
||||
else
|
||||
xasprintf(&tmp, "%s*", file);
|
||||
|
||||
/* Check if the path is absolute. */
|
||||
isabs = tmp[0] == '/';
|
||||
|
||||
memset(&g, 0, sizeof(g));
|
||||
if (remote != LOCAL) {
|
||||
tmp = make_absolute(tmp, remote_path);
|
||||
@ -1742,7 +1745,7 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
|
||||
goto out;
|
||||
|
||||
tmp2 = complete_ambiguous(file, g.gl_pathv, g.gl_matchc);
|
||||
tmp = path_strip(tmp2, remote_path);
|
||||
tmp = path_strip(tmp2, isabs ? NULL : remote_path);
|
||||
xfree(tmp2);
|
||||
|
||||
if (tmp == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user