diff options
Diffstat (limited to 'src/desktop/Window.cpp')
| -rw-r--r-- | src/desktop/Window.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index 7987c9d6..7a06aa61 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -1296,9 +1296,12 @@ std::unordered_map<std::string, std::string> CWindow::getEnv() { needle += 512; } + if (needle <= 1) + return {}; + std::replace(buffer.begin(), buffer.end() - 1, '\0', '\n'); - CVarList envs(std::string{buffer.data(), needle - 1}, 0, '\n', true); + CVarList envs(std::string{buffer.data(), buffer.size() - 1}, 0, '\n', true); for (auto& e : envs) { if (!e.contains('=')) |
