summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-03-01 16:43:40 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-03-01 16:43:40 +0000
commitbffb48371c324eb512d5593a8dceeb19edebbe89 (patch)
tree1098cc907329003a418b8a55bec5f1e33a582f70 /lib
parentaa053fe6e77a7029329540485a5df821a4d0fee4 (diff)
Fix a segfault and functional error in c_gets(),
which is used for extended command input and for vi search mode. It could be triggered by typing one or more characters, then pressing backspace once (functional error: the character was deleted from the screen, but not from the edit buffer) or a few more times than characters had been entered (segfault). OK czarkoff@. Also checked by Christos Zoulas.
Diffstat (limited to 'lib')
-rw-r--r--lib/libedit/chared.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libedit/chared.c b/lib/libedit/chared.c
index 450c75858d9..1032410b67d 100644
--- a/lib/libedit/chared.c
+++ b/lib/libedit/chared.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chared.c,v 1.16 2016/01/30 17:32:52 schwarze Exp $ */
+/* $OpenBSD: chared.c,v 1.17 2016/03/01 16:43:39 schwarze Exp $ */
/* $NetBSD: chared.c,v 1.28 2009/12/30 22:37:40 christos Exp $ */
/*-
@@ -677,6 +677,7 @@ c_gets(EditLine *el, Char *buf, const Char *prompt)
len = -1;
break;
}
+ len--;
cp--;
continue;