experimental diff:
From: Todd C. Miller <Todd.Miller@courtesan.com> The following ksh diff needs wide testing. It does the following: 1) proper error message for bad substitution. Before: $ echo ${a[@]:foo} ksh: : bad substitution After: $ echo ${a[@]:foo} ksh: ${a[@]:foo}: bad substitution 2) fix a core dump for "echo ${a[@]:?foo}". 3) fix a use-after-free bug (from otto@)
This commit is contained in:
8
expr.c
8
expr.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: expr.c,v 1.7 2004/10/28 11:53:41 tg Exp $ */
|
||||
/** $MirBSD: expr.c,v 1.8 2004/12/10 22:21:25 tg Exp $ */
|
||||
/* $OpenBSD: expr.c,v 1.9 2003/10/22 07:40:38 jmc Exp $ */
|
||||
|
||||
/*
|
||||
@ -8,7 +8,7 @@
|
||||
#include "sh.h"
|
||||
#include <ctype.h>
|
||||
|
||||
__RCSID("$MirBSD: expr.c,v 1.7 2004/10/28 11:53:41 tg Exp $");
|
||||
__RCSID("$MirBSD: expr.c,v 1.8 2004/12/10 22:21:25 tg Exp $");
|
||||
|
||||
/* The order of these enums is constrained by the order of opinfo[] */
|
||||
enum token {
|
||||
@ -176,7 +176,7 @@ v_evaluate(struct tbl *vp, const char *expr, volatile int error_ok)
|
||||
/* Clear EXPRINEVAL in of any variables we were playing with */
|
||||
if (curstate.evaling)
|
||||
curstate.evaling->flag &= ~EXPRINEVAL;
|
||||
quitenv();
|
||||
quitenv(NULL);
|
||||
if (i == LAEXPR) {
|
||||
if (error_ok == KSH_RETURN_ERROR)
|
||||
return 0;
|
||||
@ -202,7 +202,7 @@ v_evaluate(struct tbl *vp, const char *expr, volatile int error_ok)
|
||||
/* can fail if readonly */
|
||||
setstr(vp, str_val(v), error_ok);
|
||||
|
||||
quitenv();
|
||||
quitenv(NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user