diff options
| author | thejch <66577496+thejch@users.noreply.github.com> | 2024-03-19 19:33:39 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-20 02:33:39 +0000 |
| commit | 95ac8a34b1809375030b4ec2780a2b7a35ae8162 (patch) | |
| tree | 9b88926aabde8060a463cea6830d94fd3f29d9ef /src/desktop/Workspace.cpp | |
| parent | 8593c45be3cfe8055d13315051d88588f848ad39 (diff) | |
workspace: fix integer overflow in selector parser (#5177)
Diffstat (limited to 'src/desktop/Workspace.cpp')
| -rw-r--r-- | src/desktop/Workspace.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp index 42d59dbb..5a5e2c06 100644 --- a/src/desktop/Workspace.cpp +++ b/src/desktop/Workspace.cpp @@ -218,7 +218,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) { const auto NEXTSPACE = selector.find_first_of(' ', i); std::string prop = selector.substr(i, NEXTSPACE == std::string::npos ? std::string::npos : NEXTSPACE - i); - i = NEXTSPACE; + i = std::min(NEXTSPACE, std::string::npos - 1); if (cur == 'r') { int from = 0, to = 0; @@ -383,4 +383,4 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) { UNREACHABLE(); return false; -}
\ No newline at end of file +} |
