diff options
author | Calvin Lee <cyrus296@gmail.com> | 2018-01-06 19:18:06 -0700 |
---|---|---|
committer | Calvin Lee <cyrus296@gmail.com> | 2018-01-06 19:20:29 -0700 |
commit | be39e84875329210beae8ceda1fb83b3bc2ffc2a (patch) | |
tree | 5701b81b0d5e8c22f89f0702271bb2b50898ba01 | |
parent | a74d1a1992e547b9ae5baab874beb1ce743ee1c5 (diff) | |
download | sway-be39e84875329210beae8ceda1fb83b3bc2ffc2a.zip sway-be39e84875329210beae8ceda1fb83b3bc2ffc2a.tar.gz sway-be39e84875329210beae8ceda1fb83b3bc2ffc2a.tar.bz2 |
Prevent invalid free of workspace name
An allocated pointer was incremented before being freed in
`sway/workspace.c` which led to an invalid free. This has been fixed by
keeping the pointer in place and moving the data instead.
Fixes #1548
-rw-r--r-- | sway/workspace.c | 5 |
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 |