summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorasou <asou@openbsd.org>2019-09-03 02:28:25 +0000
committerasou <asou@openbsd.org>2019-09-03 02:28:25 +0000
commitbb90466644c9635fe89fb5f3b6e98a4549b941b4 (patch)
treeaf00a1c6c622b82e91e103019a18ee458b98a0b4 /lib
parentCreate remote log files in obj directory. (diff)
downloadwireguard-openbsd-bb90466644c9635fe89fb5f3b6e98a4549b941b4.tar.xz
wireguard-openbsd-bb90466644c9635fe89fb5f3b6e98a4549b941b4.zip
Correct the length for argument of reallocarray(). This fix the SEGV
when launch the vi editor in vi mode. This fix is similar 1.63 from NetBSD lib/libedit/vi.c. OK schwarze@ yasuoka@
Diffstat (limited to 'lib')
-rw-r--r--lib/libedit/vi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libedit/vi.c b/lib/libedit/vi.c
index 4be048e06fe..8c12b16aaa4 100644
--- a/lib/libedit/vi.c
+++ b/lib/libedit/vi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vi.c,v 1.26 2019/06/28 05:35:34 deraadt Exp $ */
+/* $OpenBSD: vi.c,v 1.27 2019/09/03 02:28:25 asou Exp $ */
/* $NetBSD: vi.c,v 1.33 2011/02/17 16:44:48 joerg Exp $ */
/*-
@@ -1027,7 +1027,7 @@ vi_histedit(EditLine *el, wint_t c __attribute__((__unused__)))
unlink(tempfile);
return CC_ERROR;
}
- line = reallocarray(NULL, len, sizeof(*line));
+ line = reallocarray(NULL, len + 1, sizeof(*line));
if (line == NULL) {
close(fd);
unlink(tempfile);