mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 17: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,7 +842,14 @@ void Value::mkStringMove(const char * s, const PathSet & context)
|
|||
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue