summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>1999-04-13 04:13:09 +0000
committertegge <tegge@FreeBSD.org>1999-04-13 04:13:09 +0000
commit82a8c819f3d4b3634154831a33a4cad9fc5aa5b7 (patch)
tree2f9ea23e3217ca509dd47dea0cac3ece737e84c9 /bin/sh
parent8f4b15eccc625a908df93049cbe5f0e51afd6138 (diff)
downloadFreeBSD-src-82a8c819f3d4b3634154831a33a4cad9fc5aa5b7.zip
FreeBSD-src-82a8c819f3d4b3634154831a33a4cad9fc5aa5b7.tar.gz
During variable expansion, the internal representation of the expression
might be relocated. Handle this case. PR: 7059
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/expand.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index 8a6f03a..074b32a 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -39,7 +39,7 @@
static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95";
#endif
static const char rcsid[] =
- "$Id: expand.c,v 1.24 1998/09/13 19:24:57 tegge Exp $";
+ "$Id: expand.c,v 1.25 1999/04/09 15:23:48 tegge Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -646,7 +646,7 @@ evalvar(p, flag)
int varflags;
char *var;
char *val;
- char *pat;
+ int patloc;
int c;
int set;
int special;
@@ -744,10 +744,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 */
OpenPOWER on IntegriCloud