summaryrefslogtreecommitdiff
path: root/sftp.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-11-16 03:26:01 +0000
committerDamien Miller <djm@mindrot.org>2018-11-16 14:37:33 +1100
commit2a35862e664afde774d4a72497d394fe7306ccb5 (patch)
tree501d6d170178b037829003b76cbd32e23e6080bb /sftp.c
parentd0d1dfa55be1c5c0d77ab3096b198a64235f936d (diff)
upstream: use path_absolute() for pathname checks; from Manoj Ampalam
OpenBSD-Commit-ID: 482ce71a5ea5c5f3bc4d00fd719481a6a584d925
Diffstat (limited to 'sftp.c')
-rw-r--r--sftp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sftp.c b/sftp.c
index e3091969c..ed95cf817 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp.c,v 1.187 2018/11/16 02:30:20 djm Exp $ */ 1/* $OpenBSD: sftp.c,v 1.188 2018/11/16 03:26:01 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -389,7 +389,7 @@ make_absolute(char *p, const char *pwd)
389 char *abs_str; 389 char *abs_str;
390 390
391 /* Derelativise */ 391 /* Derelativise */
392 if (p && p[0] != '/') { 392 if (p && !path_absolute(p)) {
393 abs_str = path_append(pwd, p); 393 abs_str = path_append(pwd, p);
394 free(p); 394 free(p);
395 return(abs_str); 395 return(abs_str);
@@ -1623,7 +1623,7 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd,
1623 1623
1624 /* Strip pwd off beginning of non-absolute paths */ 1624 /* Strip pwd off beginning of non-absolute paths */
1625 tmp = NULL; 1625 tmp = NULL;
1626 if (*path1 != '/') 1626 if (!path_absolute(path1))
1627 tmp = *pwd; 1627 tmp = *pwd;
1628 1628
1629 path1 = make_absolute(path1, *pwd); 1629 path1 = make_absolute(path1, *pwd);
@@ -1951,7 +1951,7 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
1951 xasprintf(&tmp, "%s*", file); 1951 xasprintf(&tmp, "%s*", file);
1952 1952
1953 /* Check if the path is absolute. */ 1953 /* Check if the path is absolute. */
1954 isabs = tmp[0] == '/'; 1954 isabs = path_absolute(tmp);
1955 1955
1956 memset(&g, 0, sizeof(g)); 1956 memset(&g, 0, sizeof(g));
1957 if (remote != LOCAL) { 1957 if (remote != LOCAL) {