mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 00:25:59 +01:00
window: fix invalid env buffer size in getEnv
This commit is contained in:
parent
4e42107d25
commit
52684b7d90
1 changed files with 4 additions and 1 deletions
|
@ -1296,9 +1296,12 @@ std::unordered_map<std::string, std::string> CWindow::getEnv() {
|
||||||
needle += 512;
|
needle += 512;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (needle <= 1)
|
||||||
|
return {};
|
||||||
|
|
||||||
std::replace(buffer.begin(), buffer.end() - 1, '\0', '\n');
|
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) {
|
for (auto& e : envs) {
|
||||||
if (!e.contains('='))
|
if (!e.contains('='))
|
||||||
|
|
Loading…
Reference in a new issue