aboutsummaryrefslogtreecommitdiff
path: root/tools/mhmake/src
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-03-08 09:36:48 +0000
committermarha <marha@users.sourceforge.net>2011-03-08 09:36:48 +0000
commitc5bfd1aa030085abb89a8f13ecc4d36bb0227d1d (patch)
tree262aaf6f94fb5618720d9f3d3c877f63e16a16a6 /tools/mhmake/src
parent6272d6626e095565120b55d77ab6c1c84d269a81 (diff)
downloadvcxsrv-c5bfd1aa030085abb89a8f13ecc4d36bb0227d1d.tar.gz
vcxsrv-c5bfd1aa030085abb89a8f13ecc4d36bb0227d1d.tar.bz2
vcxsrv-c5bfd1aa030085abb89a8f13ecc4d36bb0227d1d.zip
Added safety agains mhmakeconf value ending in backspace
Diffstat (limited to 'tools/mhmake/src')
-rw-r--r--tools/mhmake/src/mhmakefileparser.cpp54
-rw-r--r--tools/mhmake/src/util.cpp5
-rw-r--r--tools/mhmake/src/util.h2
3 files changed, 30 insertions, 31 deletions
diff --git a/tools/mhmake/src/mhmakefileparser.cpp b/tools/mhmake/src/mhmakefileparser.cpp
index 1b1119641..a359de117 100644
--- a/tools/mhmake/src/mhmakefileparser.cpp
+++ b/tools/mhmake/src/mhmakefileparser.cpp
@@ -177,38 +177,38 @@ inline string mhmakefileparser::ExpandExpression(const string &ExprIn) const
string Expr(Ret);
Ret.clear();
- size_t i=0;
- size_t Length=Expr.size();
- string ToAdd;
- while (i<Length)
- {
- char Char=Expr[i++];
- if (Char=='$')
+ size_t i=0;
+ size_t Length=Expr.size();
+ string ToAdd;
+ while (i<Length)
{
- size_t inew=SkipMakeExpr(Expr,i);
- i++;
- if (inew>i)
- {
- ToAdd=ExpandMacro(Expr.substr(i,inew-i-1));
- i=inew;
- }
- else
- {
- // This is a single character expression
- ToAdd=ExpandMacro(string(1,Expr[i-1]));
+ char Char=Expr[i++];
+ if (Char=='$')
+ {
+ size_t inew=SkipMakeExpr(Expr,i);
+ i++;
+ if (inew>i)
+ {
+ ToAdd=ExpandMacro(Expr.substr(i,inew-i-1));
+ i=inew;
+ }
+ else
+ {
+ // This is a single character expression
+ ToAdd=ExpandMacro(string(1,Expr[i-1]));
+ }
+ if (ToAdd.find('$')!=string::npos && ToAdd.length()!=1)
+ {
+ Recurse=true;
}
- if (ToAdd.find('$')!=string::npos && ToAdd.length()!=1)
- {
- Recurse=true;
+ Ret+=ToAdd;
+ }
+ else
+ {
+ Ret+=Char;
}
- Ret+=ToAdd;
- }
- else
- {
- Ret+=Char;
}
}
- }
return Ret;
}
diff --git a/tools/mhmake/src/util.cpp b/tools/mhmake/src/util.cpp
index 8b7d2b164..2ff5a03f3 100644
--- a/tools/mhmake/src/util.cpp
+++ b/tools/mhmake/src/util.cpp
@@ -341,9 +341,8 @@ loadedmakefile::loadedmakefile_statics::loadedmakefile_statics()
const char *pEnv=getenv(MHMAKECONF);
if (pEnv)
{
- string Env(QuoteFileName(pEnv));
- m_GlobalCommandLineVars[MHMAKECONF]=Env;
- m_MhMakeConf=GetAbsFileInfo(Env);
+ m_MhMakeConf=GetAbsFileInfo(pEnv);
+ m_GlobalCommandLineVars[MHMAKECONF]=QuoteFileName(m_MhMakeConf->GetFullFileName());
// Get the revision of the working copy
// We do it with the svn info command
diff --git a/tools/mhmake/src/util.h b/tools/mhmake/src/util.h
index 68cb032d7..044ac0143 100644
--- a/tools/mhmake/src/util.h
+++ b/tools/mhmake/src/util.h
@@ -50,7 +50,7 @@
#define PLATFORM "linux"
#endif
-#define MHMAKEVER "3.0.0"
+#define MHMAKEVER "3.0.1"
class makecommand
{