oksh sync; unsure if it applies (with us using old_source and all) but

better be safe than sorry; it at least passes our testsuite

NOTE: people who can figure out how afl can be used for mksh welcome! ;-)
This commit is contained in:
tg 2015-02-13 12:51:33 +00:00
parent f6f49a119b
commit 4157cca352
3 changed files with 14 additions and 7 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.678 2015/02/06 10:56:44 tg Exp $ # $MirOS: src/bin/mksh/check.t,v 1.679 2015/02/13 12:51:30 tg Exp $
# -*- mode: sh -*- # -*- mode: sh -*-
#- #-
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@ -30,7 +30,7 @@
# (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date # (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
expected-stdout: expected-stdout:
@(#)MIRBSD KSH R50 2015/02/06 @(#)MIRBSD KSH R50 2015/02/13
description: description:
Check version of shell. Check version of shell.
stdin: stdin:
@ -39,7 +39,7 @@ name: KSH_VERSION
category: shell:legacy-no category: shell:legacy-no
--- ---
expected-stdout: expected-stdout:
@(#)LEGACY KSH R50 2015/02/06 @(#)LEGACY KSH R50 2015/02/13
description: description:
Check version of legacy shell. Check version of legacy shell.
stdin: stdin:

11
main.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: main.c,v 1.54 2013/11/28 10:33:37 sobrado Exp $ */ /* $OpenBSD: main.c,v 1.55 2015/02/09 09:09:30 jsg Exp $ */
/* $OpenBSD: tty.c,v 1.10 2014/08/10 02:44:26 guenther Exp $ */ /* $OpenBSD: tty.c,v 1.10 2014/08/10 02:44:26 guenther Exp $ */
/* $OpenBSD: io.c,v 1.25 2014/08/11 20:28:47 guenther Exp $ */ /* $OpenBSD: io.c,v 1.25 2014/08/11 20:28:47 guenther Exp $ */
/* $OpenBSD: table.c,v 1.15 2012/02/19 07:52:30 otto Exp $ */ /* $OpenBSD: table.c,v 1.15 2012/02/19 07:52:30 otto Exp $ */
@ -34,7 +34,7 @@
#include <locale.h> #include <locale.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.286 2014/11/25 21:13:28 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/main.c,v 1.287 2015/02/13 12:51:31 tg Exp $");
extern char **environ; extern char **environ;
@ -892,6 +892,13 @@ unwind(int i)
/* FALLTHROUGH */ /* FALLTHROUGH */
default: default:
quitenv(NULL); quitenv(NULL);
/*
* quitenv() may have reclaimed the memory
* used by source which will end badly when
* we jump to a function that expects it to
* be valid
*/
source = NULL;
} }
} }
} }

4
sh.h
View File

@ -169,9 +169,9 @@
#endif #endif
#ifdef EXTERN #ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.710 2015/02/06 10:56:48 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.711 2015/02/13 12:51:33 tg Exp $");
#endif #endif
#define MKSH_VERSION "R50 2015/02/06" #define MKSH_VERSION "R50 2015/02/13"
/* arithmetic types: C implementation */ /* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES #if !HAVE_CAN_INTTYPES