diff options
| author | nyamatongwe <unknown> | 2003-02-17 10:05:41 +0000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2003-02-17 10:05:41 +0000 | 
| commit | ce812aa6046b4dfee328751452666ee74a40e8e9 (patch) | |
| tree | a2df1767be79a37c85034b180b9ea21d472f3341 | |
| parent | fe3af00cbb512df7e132038360c91ccb6cd13b04 (diff) | |
| download | scintilla-mirror-ce812aa6046b4dfee328751452666ee74a40e8e9.tar.gz | |
Avoid infinite expansion of recursive definitions.
| -rw-r--r-- | src/PropSet.cxx | 8 | 
1 files changed, 6 insertions, 2 deletions
| diff --git a/src/PropSet.cxx b/src/PropSet.cxx index 20495df96..18544aef2 100644 --- a/src/PropSet.cxx +++ b/src/PropSet.cxx @@ -185,7 +185,8 @@ SString PropSet::GetExpanded(const char *key) {  SString PropSet::Expand(const char *withVars) {  	char *base = StringDup(withVars);  	char *cpvar = strstr(base, "$("); -	while (cpvar) { +	int maxExpands = 1000;	// Avoid infinite expansion of recursive definitions +	while (cpvar && (maxExpands > 0)) {  		char *cpendvar = strchr(cpvar, ')');  		if (cpendvar) {  			int lenvar = cpendvar - cpvar - 2;  	// Subtract the $() @@ -201,6 +202,7 @@ SString PropSet::Expand(const char *withVars) {  			base = newbase;  		}  		cpvar = strstr(base, "$("); +		maxExpands--;  	}  	SString sret = base;  	delete []base; @@ -304,7 +306,8 @@ SString PropSet::GetWild(const char *keybase, const char *filename) {  SString PropSet::GetNewExpand(const char *keybase, const char *filename) {  	char *base = StringDup(GetWild(keybase, filename).c_str());  	char *cpvar = strstr(base, "$("); -	while (cpvar) { +	int maxExpands = 1000;	// Avoid infinite expansion of recursive definitions +	while (cpvar && (maxExpands > 0)) {  		char *cpendvar = strchr(cpvar, ')');  		if (cpendvar) {  			int lenvar = cpendvar - cpvar - 2;  	// Subtract the $() @@ -320,6 +323,7 @@ SString PropSet::GetNewExpand(const char *keybase, const char *filename) {  			base = newbase;  		}  		cpvar = strstr(base, "$("); +		maxExpands--;  	}  	SString sret = base;  	delete []base; | 
