From 380948180f847a26f2d0c85b4dad3dca2ed2fd8b Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Thu, 15 May 2014 14:25:18 +1000 Subject: [PATCH] - dtucker@cvs.openbsd.org 2014/04/29 20:36:51 [sftp.c] Don't attempt to append a nul quote char to the filename. Should prevent fatal'ing with "el_insertstr failed" when there's a single quote char somewhere in the string. bz#2238, ok markus@ --- ChangeLog | 5 +++++ sftp.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a05062951..50c83e64b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -47,6 +47,11 @@ - dtucker@cvs.openbsd.org 2014/04/29 19:58:50 [sftp.c] Move nulling of variable next to where it's freed. ok markus@ + - dtucker@cvs.openbsd.org 2014/04/29 20:36:51 + [sftp.c] + Don't attempt to append a nul quote char to the filename. Should prevent + fatal'ing with "el_insertstr failed" when there's a single quote char + somewhere in the string. bz#2238, ok markus@ 20140430 - (dtucker) [defines.h] Define __GNUC_PREREQ__ macro if we don't already diff --git a/sftp.c b/sftp.c index 90667d28c..dd4cf0dbe 100644 --- a/sftp.c +++ b/sftp.c @@ -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 * @@ -1912,7 +1912,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) != ' '))