summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2015-04-12 21:42:18 +0000
committerflorian <florian@openbsd.org>2015-04-12 21:42:18 +0000
commit04dc4095f6bf5b1b8ea785d1ec84f674c03b97c3 (patch)
tree461e9e9836426a2f047e1be189dea196cfd39fae
parentFix some KNF, spacing, and typo issues. Moving the deck chairs around to (diff)
downloadwireguard-openbsd-04dc4095f6bf5b1b8ea785d1ec84f674c03b97c3.tar.xz
wireguard-openbsd-04dc4095f6bf5b1b8ea785d1ec84f674c03b97c3.zip
Prevent use after free in definemacro().
When the startup file contains (start-kbd-macro) mg crashes when executing "start-kbd-macro" two times in the running mg. The problem is that execline() is cleaning up behind our backs. Finish the cleanup and make sure mg doesn't think we are in the middle of a macro definition. Problem found, tracked down and diff by gsoares@ Tweaked & OK by me. Committing on request of gsoares@ who currently doesn't have good net to commit.
-rw-r--r--usr.bin/mg/extend.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/mg/extend.c b/usr.bin/mg/extend.c
index 26d623809fb..083ea30eda9 100644
--- a/usr.bin/mg/extend.c
+++ b/usr.bin/mg/extend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: extend.c,v 1.61 2015/03/24 22:28:10 bcallah Exp $ */
+/* $OpenBSD: extend.c,v 1.62 2015/04/12 21:42:18 florian Exp $ */
/* This file is in the public domain. */
@@ -911,6 +911,8 @@ cleanup:
lp = np;
}
free(lp);
+ maclhead = NULL;
+ macrodef = FALSE;
return (status);
}