View | Details | Raw Unified | Return to bug 1990 | Differences between
and this patch

Collapse All | Expand All

(-)sftp.c (-4 / +9 lines)
Lines 31-36 Link Here
31
31
32
#include <ctype.h>
32
#include <ctype.h>
33
#include <errno.h>
33
#include <errno.h>
34
#include <locale.h>
34
35
35
#ifdef HAVE_PATHS_H
36
#ifdef HAVE_PATHS_H
36
# include <paths.h>
37
# include <paths.h>
Lines 1694-1701 complete_match(EditLine *el, struct sftp Link Here
1694
    char *file, int remote, int lastarg, char quote, int terminated)
1695
    char *file, int remote, int lastarg, char quote, int terminated)
1695
{
1696
{
1696
	glob_t g;
1697
	glob_t g;
1697
	char *tmp, *tmp2, ins[3];
1698
	char *tmp, *tmp2, ins[8];
1698
	u_int i, hadglob, pwdlen, len, tmplen, filelen, cesc, isesc, isabs;
1699
	u_int i, hadglob, pwdlen, len, tmplen, filelen, cesc, isesc, isabs;
1700
	int clen;
1699
	const LineInfo *lf;
1701
	const LineInfo *lf;
1700
	
1702
	
1701
	/* Glob from "file" location */
1703
	/* Glob from "file" location */
Lines 1764-1773 complete_match(EditLine *el, struct sftp Link Here
1764
		tmp2 = tmp + filelen - cesc;
1766
		tmp2 = tmp + filelen - cesc;
1765
		len = strlen(tmp2); 
1767
		len = strlen(tmp2); 
1766
		/* quote argument on way out */
1768
		/* quote argument on way out */
1767
		for (i = 0; i < len; i++) {
1769
		for (i = 0; i < len; i += clen) {
1770
			if ((clen = mblen(tmp2 + i, len - i)) == -1)
1771
					fatal("invalid multibyte char");
1768
			ins[0] = '\\';
1772
			ins[0] = '\\';
1769
			ins[1] = tmp2[i];
1773
			memcpy(ins + 1, tmp2 + i, clen);
1770
			ins[2] = '\0';
1774
			ins[clen + 1] = '\0';
1771
			switch (tmp2[i]) {
1775
			switch (tmp2[i]) {
1772
			case '\'':
1776
			case '\'':
1773
			case '"':
1777
			case '"':
Lines 2112-2117 main(int argc, char **argv) Link Here
2112
2116
2113
	/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
2117
	/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
2114
	sanitise_stdfd();
2118
	sanitise_stdfd();
2119
	setlocale(LC_CTYPE, "");
2115
2120
2116
	__progname = ssh_get_progname(argv[0]);
2121
	__progname = ssh_get_progname(argv[0]);
2117
	memset(&args, '\0', sizeof(args));
2122
	memset(&args, '\0', sizeof(args));

Return to bug 1990