Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2-0]: src/bin/sh Pull up following revision(s) (requested by mart...
details: https://anonhg.NetBSD.org/src/rev/faaa0a69a57b
branches: netbsd-2-0
changeset: 564876:faaa0a69a57b
user: riz <riz%NetBSD.org@localhost>
date: Fri Oct 28 22:52:23 2005 +0000
description:
Pull up following revision(s) (requested by martin in ticket #1418):
bin/sh/expand.c: revision 1.68
expbackq() was incorrectly backing up a temporary buffer when removing \n
from the end of output of commands inside $(...) substitutions.
If the program output is n*128+1 bytes long (ending in a \n) then the code
checks buf[-1] for another \n - looking an uninitialised stack.
On a big-endian system an integer of value 10 will satisfy this (unlikely
on little endian) and can happen depending on the last code path to use
a lot of stack!
This caused the problem with newvers.sh on sparc64 after ', 2005' was
added to the date list.
Fixed PR/28852
diffstat:
bin/sh/expand.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (28 lines):
diff -r 1e677da99d4b -r faaa0a69a57b bin/sh/expand.c
--- a/bin/sh/expand.c Thu Oct 27 03:24:21 2005 +0000
+++ b/bin/sh/expand.c Fri Oct 28 22:52:23 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: expand.c,v 1.60 2003/12/21 08:32:39 jdolecek Exp $ */
+/* $NetBSD: expand.c,v 1.60.2.1 2005/10/28 22:52:23 riz Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95";
#else
-__RCSID("$NetBSD: expand.c,v 1.60 2003/12/21 08:32:39 jdolecek Exp $");
+__RCSID("$NetBSD: expand.c,v 1.60.2.1 2005/10/28 22:52:23 riz Exp $");
#endif
#endif /* not lint */
@@ -449,7 +449,8 @@
}
/* Eat all trailing newlines */
- for (p--; lastc == '\n'; lastc = *--p)
+ p = stackblock() + startloc;
+ while (dest > p && dest[-1] == '\n')
STUNPUTC(dest);
if (in.fd >= 0)
Home |
Main Index |
Thread Index |
Old Index