From 4cd38bb87a8068bcc8c9de2fdebf7af12a11c9e6 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 20 May 2014 11:59:03 +0000 Subject: [PATCH] The argv[] used for el_set() EL_BIND, EL_SETTY, etc should be terminated by NULL. Fix from NetBSD via yasuoka@ but changed by me not to walk off the end of array with >20 arguments. ok yasuoka --- lib/libedit/eln.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libedit/eln.c b/lib/libedit/eln.c index eb14581d92b..32048078926 100644 --- a/lib/libedit/eln.c +++ b/lib/libedit/eln.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eln.c,v 1.3 2011/11/27 21:46:44 pascal Exp $ */ +/* $OpenBSD: eln.c,v 1.4 2014/05/20 11:59:03 nicm Exp $ */ /* $NetBSD: eln.c,v 1.9 2010/11/04 13:53:12 christos Exp $ */ /*- @@ -144,15 +144,15 @@ el_set(EditLine *el, int op, ...) case EL_SETTC: case EL_ECHOTC: case EL_SETTY: { - const char *argv[20]; + const char *argv[21]; int i; const wchar_t **wargv; - for (i = 1; i < (int)__arraycount(argv); ++i) + for (i = 1; i < (int)__arraycount(argv) - 1; ++i) if ((argv[i] = va_arg(ap, char *)) == NULL) break; - argv[0] = NULL; + argv[0] = argv[i] = NULL; wargv = (const wchar_t **) - ct_decode_argv(i, argv, &el->el_lgcyconv); + ct_decode_argv(i + 1, argv, &el->el_lgcyconv); if (!wargv) { ret = -1; goto out; -- 2.20.1