summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2017-11-21 17:57:41 +0000
committertb <tb@openbsd.org>2017-11-21 17:57:41 +0000
commite7db493651eb025d7f7e2c0d1211b5fcbb7c9ce7 (patch)
tree31ac86873c037d118296c19c5eed36fe3f6ba1d4
parentUse a simple forward search to find '%' in the format string instead of (diff)
downloadwireguard-openbsd-e7db493651eb025d7f7e2c0d1211b5fcbb7c9ce7.tar.xz
wireguard-openbsd-e7db493651eb025d7f7e2c0d1211b5fcbb7c9ce7.zip
Initialize *histbase to NULL to fix a bus error in emacs editing mode
found by anton. To reproduce, run "env EDITOR=emacs MALLOC_OPTIONS=J ksh" then press "^[_". ok anton, jca
-rw-r--r--bin/ksh/history.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/ksh/history.c b/bin/ksh/history.c
index 14919d8b092..1a8f8de011c 100644
--- a/bin/ksh/history.c
+++ b/bin/ksh/history.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: history.c,v 1.74 2017/10/23 15:43:38 jca Exp $ */
+/* $OpenBSD: history.c,v 1.75 2017/11/21 17:57:41 tb Exp $ */
/*
* command history
@@ -607,6 +607,7 @@ init_histvec(void)
*/
histbase = areallocarray(NULL, histsize + 1, sizeof(char *),
APERM);
+ *histbase = NULL;
history = histbase + 1;
histptr = history - 1;
}