[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Invalid optimisation in _AS_PATH_WALK

From: Andreas Schwab
Subject: Invalid optimisation in _AS_PATH_WALK
Date: Thu, 04 Apr 2002 13:38:11 +0200
User-agent: Gnus/5.090005 (Oort Gnus v0.05) Emacs/21.2.50 (ia64-suse-linux)

_AS_PATH_WALK always optimizes away $as_dummy if $1 contains variable
references.  This is wrong.  Only the _result_ of an expansion is subject
to field splitting.  Literal text is never split, even if it is part of
the same word with expansions.


2002-04-04  Andreas Schwab  <address@hidden>

        * lib/m4sugar/m4sh.m4 (_AS_PATH_WALK): Only simplify if path
        contains no literal separators.

--- lib/m4sugar/m4sh.m4.~1.80.~ 2002-04-03 13:19:13.000000000 +0200
+++ lib/m4sugar/m4sh.m4 2002-04-04 11:32:43.000000000 +0200
@@ -626,13 +626,14 @@
 # Still very private as its interface looks quite bad.
 # `$as_dummy' forces splitting on constant user-supplied paths.
-# POSIX.2 word splitting is done only on the output of word
-# expansions, not every word.  This closes a longstanding sh security
-# hole.  Optimize it away when not needed.
+# POSIX.2 field splitting is done only on the result of word
+# expansions, not on literal text.  This closes a longstanding sh security
+# hole.  Optimize it away when not needed, i.e., if there are no literal
+# path separators.
-AS_LITERAL_IF(m4_default([$1], [$PATH]),
+m4_bmatch([$1], [[:;]],
 for as_dir in $as_dummy],
 [for as_dir in m4_default([$1], [$PATH])])

Andreas Schwab, SuSE Labs, address@hidden
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 N├╝rnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]