diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-01-22 11:04:56 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-22 11:04:56 -0500 |
commit | 04aa41de340b82d4eccc5c0c86fa6f9c178b72d5 (patch) | |
tree | 75c61907f094838e23899231ec5ec955c530f692 /sway/commands | |
parent | 71a37ad186ba3080338b2ecb5a3e640600aefc1f (diff) | |
parent | 0af5b26e41c5141d4094652133c230d76bf82e56 (diff) |
Merge pull request #3496 from mstoeckl/fix-san
Fix dead stores found by scan-build
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/focus.c | 1 | ||||
-rw-r--r-- | sway/commands/resize.c | 11 |
2 files changed, 7 insertions, 5 deletions
diff --git a/sway/commands/focus.c b/sway/commands/focus.c index e7680062..0622f2e8 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c @@ -123,7 +123,6 @@ static struct sway_node *node_get_in_direction(struct sway_container *container, if (can_move) { if (desired < 0 || desired >= siblings->length) { - can_move = false; int len = siblings->length; if (config->focus_wrapping != WRAP_NO && !wrap_candidate && len > 1) { diff --git a/sway/commands/resize.c b/sway/commands/resize.c index 0e497239..204de539 100644 --- a/sway/commands/resize.c +++ b/sway/commands/resize.c @@ -478,8 +478,9 @@ static struct cmd_results *cmd_resize_set(int argc, char **argv) { argc--; argv++; } int num_consumed_args = parse_resize_amount(argc, argv, &height); - argc -= num_consumed_args; - argv += num_consumed_args; + if (argc > num_consumed_args) { + return cmd_results_new(CMD_INVALID, usage); + } if (width.unit == RESIZE_UNIT_INVALID) { return cmd_results_new(CMD_INVALID, usage); } @@ -543,12 +544,14 @@ static struct cmd_results *cmd_resize_adjust(int argc, char **argv, struct resize_amount second_amount; if (argc) { int num_consumed_args = parse_resize_amount(argc, argv, &second_amount); - argc -= num_consumed_args; - argv += num_consumed_args; + if (argc > num_consumed_args) { + return cmd_results_new(CMD_INVALID, usage); + } if (second_amount.unit == RESIZE_UNIT_INVALID) { return cmd_results_new(CMD_INVALID, usage); } } else { + second_amount.amount = 0; second_amount.unit = RESIZE_UNIT_INVALID; } |