Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Apr 1999 04:01:30 +0200
From:      Tor.Egge@fast.no
To:        cracauer@cons.org
Cc:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: bin/7059: sh dumps core on this script
Message-ID:  <199904130201.EAA29457@midten.fast.no>
In-Reply-To: Your message of "Mon, 12 Apr 1999 09:30:02 -0700 (PDT)"
References:  <199904121630.JAA16202@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

Suggested fix:

Index: expand.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/expand.c,v
retrieving revision 1.25
diff -u -r1.25 expand.c
--- expand.c	1999/04/09 15:23:48	1.25
+++ expand.c	1999/04/13 01:46:12
@@ -646,7 +646,7 @@
 	int varflags;
 	char *var;
 	char *val;
-	char *pat;
+	int patloc;
 	int c;
 	int set;
 	int special;
@@ -744,10 +744,10 @@
 		 * 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 */


- Tor Egge


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199904130201.EAA29457>