summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Schlyter <jakob@cvs.openbsd.org>2001-07-31 12:42:51 +0000
committerJakob Schlyter <jakob@cvs.openbsd.org>2001-07-31 12:42:51 +0000
commit82d4b55685adc1fdb428ccc384d132d945b269e3 (patch)
tree85365978ae970a8ff0a18e3e5155417b00f9273a
parentd55e26f045f6680217a2a10abdf8f8c18e983f91 (diff)
avoid paths beginning with "//"; <vinschen@redhat.com>
ok markus@
-rw-r--r--usr.bin/ssh/sftp-int.c5
-rw-r--r--usr.bin/ssh/sftp-server.c6
2 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/ssh/sftp-int.c b/usr.bin/ssh/sftp-int.c
index 77b20f5f691..9fb39f843a4 100644
--- a/usr.bin/ssh/sftp-int.c
+++ b/usr.bin/ssh/sftp-int.c
@@ -26,7 +26,7 @@
/* XXX: recursive operations */
#include "includes.h"
-RCSID("$OpenBSD: sftp-int.c,v 1.38 2001/07/09 07:04:53 deraadt Exp $");
+RCSID("$OpenBSD: sftp-int.c,v 1.39 2001/07/31 12:42:50 jakob Exp $");
#include <glob.h>
@@ -206,7 +206,8 @@ path_append(char *p1, char *p2)
ret = xmalloc(len);
strlcpy(ret, p1, len);
- strlcat(ret, "/", len);
+ if (strcmp(p1, "/") != 0)
+ strlcat(ret, "/", len);
strlcat(ret, p2, len);
return(ret);
diff --git a/usr.bin/ssh/sftp-server.c b/usr.bin/ssh/sftp-server.c
index b8e0f842f31..7f442f86f07 100644
--- a/usr.bin/ssh/sftp-server.c
+++ b/usr.bin/ssh/sftp-server.c
@@ -22,7 +22,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
-RCSID("$OpenBSD: sftp-server.c,v 1.29 2001/06/25 08:25:40 markus Exp $");
+RCSID("$OpenBSD: sftp-server.c,v 1.30 2001/07/31 12:42:50 jakob Exp $");
#include "buffer.h"
#include "bufaux.h"
@@ -736,8 +736,8 @@ process_readdir(void)
stats = xrealloc(stats, nstats * sizeof(Stat));
}
/* XXX OVERFLOW ? */
- snprintf(pathname, sizeof pathname,
- "%s/%s", path, dp->d_name);
+ snprintf(pathname, sizeof pathname, "%s%s%s", path,
+ strcmp(path, "/") ? "/" : "", dp->d_name);
if (lstat(pathname, &st) < 0)
continue;
stat_to_attrib(&st, &(stats[count].attrib));