fix attempt to free pointer to stack (function-local storage)

discovered by Elias Pipping
patch by Jared Yanovich
alloc/afree checker by Todd C. Miller
This commit is contained in:
tg
2008-07-14 12:29:06 +00:00
parent a9f219dd60
commit 5f0269ed9a
4 changed files with 24 additions and 11 deletions

7
syn.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.23 2008/07/12 16:56:40 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.24 2008/07/14 12:29:06 tg Exp $");
struct nesting_state {
int start_token; /* token than began nesting (eg, FOR) */
@ -411,6 +411,11 @@ get_command(int cf)
case TIME:
syniocf &= ~(KEYWORD|ALIAS);
t = pipeline(0);
if (t) {
t->str = alloc(2, ATEMP);
t->str[0] = 0; /* TF_* flags */
t->str[1] = '\0';
}
t = block(TTIME, t, NOBLOCK, NOWORDS);
break;