|
From: <sv...@va...> - 2006-07-05 22:54:55
|
Author: sewardj
Date: 2006-07-05 23:54:49 +0100 (Wed, 05 Jul 2006)
New Revision: 5981
Log:
match_script: redo somewhat dubious (although not obviously wrong)
logic.
load_script: fix bug causing incorrect identification of script arg in
the case where there is whitespace after the script name.
Modified:
trunk/coregrind/m_ume.c
Modified: trunk/coregrind/m_ume.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_ume.c 2006-07-05 17:49:01 UTC (rev 5980)
+++ trunk/coregrind/m_ume.c 2006-07-05 22:54:49 UTC (rev 5981)
@@ -529,11 +529,21 @@
if (0 !=3D VG_(memcmp)(hdr, "#!", 2)) return False;
=20
// Find interpreter name, make sure it's an absolute path (starts wit=
h
- // '/') and has at least one more char.
+ // '/') and has at least one more char. First, skip over any space
+ // between the #! and the start of the interpreter name
while (interp < end && VG_(isspace)(*interp)) interp++;
+
+ // overrun?
+ if (interp >=3D end) return False; // can't find start of interp n=
ame
+
+ // interp should now point at the /
if (*interp !=3D '/') return False; // absolute path only for inter=
preter
- if (interp =3D=3D end) return False; // nothing after the '/'
=20
+ // check for something plausible after the /
+ interp++;
+ if (interp >=3D end) return False;
+ if (VG_(isspace)(*interp)) return False;
+
// Here we should get the full interpreter name and check it with
// check_executable(). See the "EXEC FAILED" failure when running sh=
ell
// for an example.
@@ -584,7 +594,7 @@
=20
if (!eol && cp < end) {
/* skip space before arg */
- while (cp < end && VG_(isspace)(*cp))
+ while (cp < end && VG_(isspace)(*cp) && *cp !=3D '\n')
cp++;
=20
/* arg is from here to eol */
|