Merge pull request #9934 from nmeum/absPath-out-of-bounds

absPath: Explicitly check if path is empty before accessing it
(cherry picked from commit 6ec08b85f607852eb6f976c1392c4917d0a53787)
Change-Id: Ieeb53fb65d0e334e6017ceb3a48b3b6ae1047843
This commit is contained in:
eldritch horrors 2024-03-07 03:35:47 +01:00
parent 25cae6d377
commit 65f1b15c95

View file

@ -115,7 +115,7 @@ void replaceEnv(const std::map<std::string, std::string> & newEnv)
Path absPath(Path path, std::optional<PathView> dir, bool resolveSymlinks)
{
if (path[0] != '/') {
if (path.empty() || path[0] != '/') {
if (!dir) {
#ifdef __GNU__
/* GNU (aka. GNU/Hurd) doesn't have any limitation on path