From: florian Date: Sun, 12 Apr 2015 21:42:18 +0000 (+0000) Subject: Prevent use after free in definemacro(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=04dc4095f6bf5b1b8ea785d1ec84f674c03b97c3;p=openbsd 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. --- 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); }