Don't attempt to append a nul quote char to the filename. Should prevent
authordtucker <dtucker@openbsd.org>
Tue, 29 Apr 2014 20:36:51 +0000 (20:36 +0000)
committerdtucker <dtucker@openbsd.org>
Tue, 29 Apr 2014 20:36:51 +0000 (20:36 +0000)
fatal'ing with "el_insertstr failed" when there's a single quote char
somewhere in the string.  bz#2238, ok markus@

usr.bin/ssh/sftp.c

index 02f336c..b534445 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.161 2014/04/29 19:58:50 dtucker Exp $ */
+/* $OpenBSD: sftp.c,v 1.162 2014/04/29 20:36:51 dtucker Exp $ */
 /*
  * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
  *
@@ -1890,7 +1890,7 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
        lf = el_line(el);
        if (g.gl_matchc == 1) {
                i = 0;
-               if (!terminated)
+               if (!terminated && quote != '\0')
                        ins[i++] = quote;
                if (*(lf->cursor - 1) != '/' &&
                    (lastarg || *(lf->cursor) != ' '))