aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-09-03 05:06:28 +0000
committer_ov4 <ov4@ov4.org>2026-09-03 05:06:28 +0000
commit7b27a3efde5d19c592ce674da26fdf0a6ef628a9 (patch)
tree9fb3910ec96baf0583c67c41c9db3e88252c24ce /src
parent816ea0743a9cd96e6e3888f446b4344afc932ef4 (diff)
fix UB
Diffstat (limited to 'src')
-rw-r--r--src/path.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/path.cc b/src/path.cc
index 1d14528..3ab8c0c 100644
--- a/src/path.cc
+++ b/src/path.cc
@@ -31,7 +31,8 @@ string path_unifier(const string &s, bool is_cmd)
// single word, use path
if (is_cmd && (s.find("/") == string::npos))
{
- string path = getenv("PATH");
+ const char *path_p = getenv("PATH");
+ string path = (path_p != nullptr) ? path_p : "";
size_t i = 0, j = 0, l = path.size();
while (true)
{