From e0f60300ff7bc4d06f863ba084e6be80bb8faae8 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 3 Feb 2001 01:17:13 +0000 Subject: Fixed infinite recursion when a value contains a reference to itself. --- src/PropSet.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/PropSet.cxx b/src/PropSet.cxx index 2799e3c3e..61aa7e169 100644 --- a/src/PropSet.cxx +++ b/src/PropSet.cxx @@ -96,6 +96,16 @@ SString PropSet::Get(const char *key) { SString PropSet::GetExpanded(const char *key) { SString val = Get(key); + const char *var = strstr(val.c_str(), "$("); + while (var) { + if (isprefix(var+2, key) && (var[2 + strlen(key)] == ')')) { + // Found $(key) which would lead to an infinite loop so exit + return val; + } + var = strstr(var + 2, ")"); + if (var) + var = strstr(var + 1, "$("); + } return Expand(val.c_str()); } -- cgit v1.2.3