diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2014-05-20 11:59:04 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2014-05-20 11:59:04 +0000 |
commit | c9ee00fc552f0aa3c5b0cde976112be853227e0a (patch) | |
tree | 21469102f36097f46a3ba911d39c5e3afbb8b260 /lib/libedit | |
parent | 19b372911fd4bad70c4f2bcde990069a1cf77ef6 (diff) |
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
Diffstat (limited to 'lib/libedit')
-rw-r--r-- | lib/libedit/eln.c | 10 |
1 files 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; |