summaryrefslogtreecommitdiff
path: root/lib/libedit
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2019-01-29 09:47:01 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2019-01-29 09:47:01 +0000
commitcda1edf0884ddff64a21275808c9c3fa9be3c5f1 (patch)
treecb29e18a1ecb29f4798959ea1a8deac05d138dc5 /lib/libedit
parent33bce27b227d94f21ed048417ccce65d25b21c82 (diff)
Terminate NULL in argv. This fix is come from 1.31 from NetBSD
lib/libedit/chartype.c via FreeBSD. From tj@ ok tb
Diffstat (limited to 'lib/libedit')
-rw-r--r--lib/libedit/chartype.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libedit/chartype.c b/lib/libedit/chartype.c
index 77ba9ab2754..dd3db3f7629 100644
--- a/lib/libedit/chartype.c
+++ b/lib/libedit/chartype.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chartype.c,v 1.15 2016/04/11 21:17:29 schwarze Exp $ */
+/* $OpenBSD: chartype.c,v 1.16 2019/01/29 09:47:00 yasuoka Exp $ */
/* $NetBSD: chartype.c,v 1.6 2011/07/28 00:48:21 christos Exp $ */
/*-
@@ -145,7 +145,7 @@ ct_decode_argv(int argc, const char *argv[], ct_buffer_t *conv)
if (!conv->wsize)
return NULL;
- wargv = reallocarray(NULL, argc, sizeof(*wargv));
+ wargv = reallocarray(NULL, argc + 1, sizeof(*wargv));
for (i = 0, p = conv->wbuff; i < argc; ++i) {
if (!argv[i]) { /* don't pass null pointers to mbstowcs */
@@ -164,6 +164,7 @@ ct_decode_argv(int argc, const char *argv[], ct_buffer_t *conv)
bufspace -= wlen;
p += wlen;
}
+ wargv[i] = NULL;
return wargv;
}