Always NULL terminate the argv[] array. From OpenBSD.
This commit is contained in:
parent
41a1d8830e
commit
368fe5a982
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: eln.c,v 1.15 2014/02/26 13:50:29 christos Exp $ */
|
||||
/* $NetBSD: eln.c,v 1.16 2014/05/20 15:05:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
__RCSID("$NetBSD: eln.c,v 1.15 2014/02/26 13:50:29 christos Exp $");
|
||||
__RCSID("$NetBSD: eln.c,v 1.16 2014/05/20 15:05:08 christos Exp $");
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
#include "histedit.h"
|
||||
|
@ -158,10 +158,10 @@ el_set(EditLine *el, int op, ...)
|
|||
const char *argv[20];
|
||||
int i;
|
||||
const wchar_t **wargv;
|
||||
for (i = 1; i < (int)__arraycount(argv); ++i)
|
||||
if ((argv[i] = va_arg(ap, char *)) == NULL)
|
||||
for (i = 1; i < (int)__arraycount(argv) - 1; ++i)
|
||||
if ((argv[i] = va_arg(ap, const char *)) == NULL)
|
||||
break;
|
||||
argv[0] = NULL;
|
||||
argv[0] = argv[i] = NULL;
|
||||
wargv = (const wchar_t **)
|
||||
ct_decode_argv(i + 1, argv, &el->el_lgcyconv);
|
||||
if (!wargv) {
|
||||
|
|
Loading…
Reference in New Issue