forked from lix-project/lix
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:
parent
25cae6d377
commit
65f1b15c95
|
@ -115,7 +115,7 @@ void replaceEnv(const std::map<std::string, std::string> & newEnv)
|
||||||
|
|
||||||
Path absPath(Path path, std::optional<PathView> dir, bool resolveSymlinks)
|
Path absPath(Path path, std::optional<PathView> dir, bool resolveSymlinks)
|
||||||
{
|
{
|
||||||
if (path[0] != '/') {
|
if (path.empty() || path[0] != '/') {
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
#ifdef __GNU__
|
#ifdef __GNU__
|
||||||
/* GNU (aka. GNU/Hurd) doesn't have any limitation on path
|
/* GNU (aka. GNU/Hurd) doesn't have any limitation on path
|
||||||
|
|
Loading…
Reference in a new issue