Bugzilla – Attachment 2291 Details for
Bug 1990
sftp segfaults when tab-completing a directory which contains umlauts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
make sftp just utf-8 aware enough to not crash libedit
sftp-utf8-complete.patch (text/plain), 1.48 KB, created by
Darren Tucker
on 2013-06-02 09:38:51 AEST
(
hide
)
Description:
make sftp just utf-8 aware enough to not crash libedit
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2013-06-02 09:38:51 AEST
Size:
1.48 KB
patch
obsolete
>Index: sftp.c >=================================================================== >RCS file: /home/dtucker/openssh/cvs/openssh/sftp.c,v >retrieving revision 1.154 >diff -u -p -r1.154 sftp.c >--- sftp.c 22 Feb 2013 22:12:24 -0000 1.154 >+++ sftp.c 1 Jun 2013 22:58:59 -0000 >@@ -31,6 +31,7 @@ > > #include <ctype.h> > #include <errno.h> >+#include <locale.h> > > #ifdef HAVE_PATHS_H > # include <paths.h> >@@ -1694,8 +1695,9 @@ complete_match(EditLine *el, struct sftp > char *file, int remote, int lastarg, char quote, int terminated) > { > glob_t g; >- char *tmp, *tmp2, ins[3]; >+ char *tmp, *tmp2, ins[8]; > u_int i, hadglob, pwdlen, len, tmplen, filelen, cesc, isesc, isabs; >+ int clen; > const LineInfo *lf; > > /* Glob from "file" location */ >@@ -1764,10 +1766,13 @@ complete_match(EditLine *el, struct sftp > tmp2 = tmp + filelen - cesc; > len = strlen(tmp2); > /* quote argument on way out */ >- for (i = 0; i < len; i++) { >+ for (i = 0; i < len; i += clen) { >+ if ((clen = mblen(tmp2 + i, len - i)) == -1 || >+ clen > sizeof(ins) - 2) >+ fatal("invalid multibyte character"); > ins[0] = '\\'; >- ins[1] = tmp2[i]; >- ins[2] = '\0'; >+ memcpy(ins + 1, tmp2 + i, clen); >+ ins[clen + 1] = '\0'; > switch (tmp2[i]) { > case '\'': > case '"': >@@ -2112,6 +2117,7 @@ main(int argc, char **argv) > > /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ > sanitise_stdfd(); >+ setlocale(LC_CTYPE, ""); > > __progname = ssh_get_progname(argv[0]); > memset(&args, '\0', sizeof(args));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1990
:
2285
|
2286
|
2289
| 2291