aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-01-06 21:55:06 -0500
committerGitHub <noreply@github.com>2018-01-06 21:55:06 -0500
commitc6d54f364f35018648708768f05224e3f0f317d7 (patch)
tree5701b81b0d5e8c22f89f0702271bb2b50898ba01
parenta74d1a1992e547b9ae5baab874beb1ce743ee1c5 (diff)
parentbe39e84875329210beae8ceda1fb83b3bc2ffc2a (diff)
downloadsway-c6d54f364f35018648708768f05224e3f0f317d7.zip
sway-c6d54f364f35018648708768f05224e3f0f317d7.tar.gz
sway-c6d54f364f35018648708768f05224e3f0f317d7.tar.bz2
Merge pull request #1559 from 4e554c4c/invalid_free
Prevent invalid free of workspace name
-rw-r--r--sway/workspace.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sway/workspace.c b/sway/workspace.c
index e036719..42525f3 100644
--- a/sway/workspace.c
+++ b/sway/workspace.c
@@ -68,8 +68,9 @@ char *workspace_next_name(const char *output_name) {
sway_log(L_DEBUG, "Got valid workspace command for target: '%s'", name);
char *_target = strdup(name);
strip_quotes(_target);
- while (isspace(*_target))
- _target++;
+ while (isspace(*_target)) {
+ memmove(_target, _target+1, strlen(_target+1));
+ }
// Make sure that the command references an actual workspace
// not a command about workspaces