From 7b27a3efde5d19c592ce674da26fdf0a6ef628a9 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 3 Sep 2026 05:06:28 +0000 Subject: fix UB --- src/path.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/path.cc') 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) { -- cgit v1.3.1-4-g156e