Fix for bin/7502, from Tor Egge / FreeBSD. Their commit message:

> During variable expansion, the internal representation of the expression
> might be relocated.  Handle this case.
This commit is contained in:
he 1999-04-30 17:54:17 +00:00
parent c7ea24c151
commit e97b0193be
1 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: expand.c,v 1.46 1999/04/06 21:05:27 he Exp $ */
/* $NetBSD: expand.c,v 1.47 1999/04/30 17:54:17 he Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95";
#else
__RCSID("$NetBSD: expand.c,v 1.46 1999/04/06 21:05:27 he Exp $");
__RCSID("$NetBSD: expand.c,v 1.47 1999/04/30 17:54:17 he Exp $");
#endif
#endif /* not lint */
@ -622,7 +622,7 @@ evalvar(p, flag)
int varflags;
char *var;
char *val;
char *pat;
int patloc;
int c;
int set;
int special;
@ -720,10 +720,10 @@ record:
* right after it
*/
STPUTC('\0', expdest);
pat = expdest;
if (subevalvar(p, NULL, expdest - stackblock(), subtype,
patloc = expdest - stackblock();
if (subevalvar(p, NULL, patloc, subtype,
startloc, varflags) == 0) {
int amount = (expdest - pat) + 1;
int amount = (expdest - stackblock() - patloc) + 1;
STADJUST(-amount, expdest);
}
/* Remove any recorded regions beyond start of variable */