mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Value::mkPath: Avoid potential crash from null string_view
This commit is contained in:
parent
1b978596b5
commit
bbf55383e7
1 changed files with 8 additions and 1 deletions
|
@ -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