BUG: Fixed off-by-one error in ExpandVariablesInString for case of $ or @ as last character of string.
This commit is contained in:
parent
9e5c769c29
commit
ee12492c0a
|
@ -823,8 +823,9 @@ void cmMakefile::ExpandVariablesInString(std::string& source,
|
|||
|
||||
// start by look for $ or @ in the string
|
||||
std::string::size_type markerPos = source.find_first_of("$@");
|
||||
// if not found then leave quick as nothing needs to be expanded
|
||||
if(markerPos == std::string::npos && markerPos > source.size()-1)
|
||||
// if not found, or found as the last character, then leave quickly as
|
||||
// nothing needs to be expanded
|
||||
if((markerPos == std::string::npos) || (markerPos >= source.size()-1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -832,7 +833,7 @@ void cmMakefile::ExpandVariablesInString(std::string& source,
|
|||
std::string::size_type currentPos =0; // start at 0
|
||||
std::string result; // string with replacements
|
||||
// go until the the end of the string
|
||||
while(markerPos != std::string::npos)
|
||||
while((markerPos != std::string::npos) && (markerPos < source.size()-1))
|
||||
{
|
||||
// grab string from currentPos to the start of the variable
|
||||
// and add it to the result
|
||||
|
|
Loading…
Reference in New Issue