forked from lix-project/lix
Value::mkPath: Avoid potential crash from null string_view
This commit is contained in:
parent
1b978596b5
commit
bbf55383e7
|
@ -842,8 +842,15 @@ void Value::mkStringMove(const char * s, const PathSet & context)
|
||||||
|
|
||||||
void Value::mkPath(std::string_view s)
|
void Value::mkPath(std::string_view s)
|
||||||
{
|
{
|
||||||
|
if (s.size() == 0) {
|
||||||
|
// Pathological, but better than crashing in dupStringWithLen, as
|
||||||
|
// s.data() may be null.
|
||||||
|
mkPath("");
|
||||||
|
}
|
||||||
|
else {
|
||||||
mkPath(dupStringWithLen(s.data(), s.size()));
|
mkPath(dupStringWithLen(s.data(), s.size()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Value * EvalState::lookupVar(Env * env, const ExprVar & var, bool noEval)
|
inline Value * EvalState::lookupVar(Env * env, const ExprVar & var, bool noEval)
|
||||||
|
|
Loading…
Reference in a new issue