summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--sftp.c16
2 files changed, 17 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 0e9c26755..aab923a71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,12 @@
25 - dtucker@cvs.openbsd.org 2013/06/04 19:12:23 25 - dtucker@cvs.openbsd.org 2013/06/04 19:12:23
26 [scp.c] 26 [scp.c]
27 use MAXPATHLEN for buffer size instead of fixed value. ok markus 27 use MAXPATHLEN for buffer size instead of fixed value. ok markus
28 - dtucker@cvs.openbsd.org 2013/06/04 20:42:36
29 [sftp.c]
30 Make sftp's libedit interface marginally multibyte aware by building up
31 the quoted string by character instead of by byte. Prevents failures
32 when linked against a libedit built with wide character support (bz#1990).
33 "looks ok" djm
28 34
2920130602 3520130602
30 - (tim) [Makefile.in] Make Solaris, UnixWare, & OpenServer linkers happy 36 - (tim) [Makefile.in] Make Solaris, UnixWare, & OpenServer linkers happy
diff --git a/sftp.c b/sftp.c
index a723fa643..0c90fd1e4 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp.c,v 1.145 2013/05/17 00:13:14 djm Exp $ */ 1/* $OpenBSD: sftp.c,v 1.146 2013/06/04 20:42:36 dtucker 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 *
@@ -38,6 +38,7 @@
38#ifdef HAVE_LIBGEN_H 38#ifdef HAVE_LIBGEN_H
39#include <libgen.h> 39#include <libgen.h>
40#endif 40#endif
41#include <locale.h>
41#ifdef USE_LIBEDIT 42#ifdef USE_LIBEDIT
42#include <histedit.h> 43#include <histedit.h>
43#else 44#else
@@ -1701,8 +1702,9 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
1701 char *file, int remote, int lastarg, char quote, int terminated) 1702 char *file, int remote, int lastarg, char quote, int terminated)
1702{ 1703{
1703 glob_t g; 1704 glob_t g;
1704 char *tmp, *tmp2, ins[3]; 1705 char *tmp, *tmp2, ins[8];
1705 u_int i, hadglob, pwdlen, len, tmplen, filelen, cesc, isesc, isabs; 1706 u_int i, hadglob, pwdlen, len, tmplen, filelen, cesc, isesc, isabs;
1707 int clen;
1706 const LineInfo *lf; 1708 const LineInfo *lf;
1707 1709
1708 /* Glob from "file" location */ 1710 /* Glob from "file" location */
@@ -1771,10 +1773,13 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
1771 tmp2 = tmp + filelen - cesc; 1773 tmp2 = tmp + filelen - cesc;
1772 len = strlen(tmp2); 1774 len = strlen(tmp2);
1773 /* quote argument on way out */ 1775 /* quote argument on way out */
1774 for (i = 0; i < len; i++) { 1776 for (i = 0; i < len; i += clen) {
1777 if ((clen = mblen(tmp2 + i, len - i)) < 0 ||
1778 (size_t)clen > sizeof(ins) - 2)
1779 fatal("invalid multibyte character");
1775 ins[0] = '\\'; 1780 ins[0] = '\\';
1776 ins[1] = tmp2[i]; 1781 memcpy(ins + 1, tmp2 + i, clen);
1777 ins[2] = '\0'; 1782 ins[clen + 1] = '\0';
1778 switch (tmp2[i]) { 1783 switch (tmp2[i]) {
1779 case '\'': 1784 case '\'':
1780 case '"': 1785 case '"':
@@ -2120,6 +2125,7 @@ main(int argc, char **argv)
2120 2125
2121 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ 2126 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
2122 sanitise_stdfd(); 2127 sanitise_stdfd();
2128 setlocale(LC_CTYPE, "");
2123 2129
2124 __progname = ssh_get_progname(argv[0]); 2130 __progname = ssh_get_progname(argv[0]);
2125 memset(&args, '\0', sizeof(args)); 2131 memset(&args, '\0', sizeof(args));