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
This commit is contained in:
Calvin Lee 2018-01-06 19:18:06 -07:00
parent a74d1a1992
commit be39e84875

View file

@ -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