aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-07 03:35:47 +0100
committereldritch horrors <pennae@lix.systems>2024-03-07 03:35:47 +0100
commit65f1b15c953805816133db3d3f92ff4c35c57741 (patch)
tree070fa57e4791f5abbf437894cdea2e93905cebaa /src
parent25cae6d377844afb5f592a6ff87b0c2034240178 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/libutil/util.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 6fcce5d67..51cda9da4 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -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