aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/output
diff options
context:
space:
mode:
authorLibravatar Dominique Martinet <asmadeus@codewreck.org>2018-06-30 22:16:54 +0900
committerLibravatar Dominique Martinet <asmadeus@codewreck.org>2018-07-02 08:03:41 +0900
commitab187405297b77f85e0d5ed9630ae43b2db61324 (patch)
treeaa8de78559f56439eff75d8b605eaa0d347a9f32 /sway/commands/output
parentconfig_commands_command: make alloc failure check more permanent (diff)
downloadsway-ab187405297b77f85e0d5ed9630ae43b2db61324.tar.gz
sway-ab187405297b77f85e0d5ed9630ae43b2db61324.tar.zst
sway-ab187405297b77f85e0d5ed9630ae43b2db61324.zip
output commands: move !argc checks after argc gets decremented
Found through static analysis.
Diffstat (limited to 'sway/commands/output')
-rw-r--r--sway/commands/output/mode.c2
-rw-r--r--sway/commands/output/position.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sway/commands/output/mode.c b/sway/commands/output/mode.c
index daec6d44..ef56ae9e 100644
--- a/sway/commands/output/mode.c
+++ b/sway/commands/output/mode.c
@@ -36,11 +36,11 @@ struct cmd_results *output_cmd_mode(int argc, char **argv) {
36 } 36 }
37 } else { 37 } else {
38 // Format is 1234 4321 38 // Format is 1234 4321
39 argc--; argv++;
39 if (!argc) { 40 if (!argc) {
40 return cmd_results_new(CMD_INVALID, "output", 41 return cmd_results_new(CMD_INVALID, "output",
41 "Missing mode argument (height)."); 42 "Missing mode argument (height).");
42 } 43 }
43 argc--; argv++;
44 output->height = strtol(*argv, &end, 10); 44 output->height = strtol(*argv, &end, 10);
45 if (*end) { 45 if (*end) {
46 return cmd_results_new(CMD_INVALID, "output", 46 return cmd_results_new(CMD_INVALID, "output",
diff --git a/sway/commands/output/position.c b/sway/commands/output/position.c
index c2aeb281..449767b1 100644
--- a/sway/commands/output/position.c
+++ b/sway/commands/output/position.c
@@ -27,11 +27,11 @@ struct cmd_results *output_cmd_position(int argc, char **argv) {
27 } 27 }
28 } else { 28 } else {
29 // Format is 1234 4321 (legacy) 29 // Format is 1234 4321 (legacy)
30 argc--; argv++;
30 if (!argc) { 31 if (!argc) {
31 return cmd_results_new(CMD_INVALID, "output", 32 return cmd_results_new(CMD_INVALID, "output",
32 "Missing position argument (y)."); 33 "Missing position argument (y).");
33 } 34 }
34 argc--; argv++;
35 config->handler_context.output_config->y = strtol(*argv, &end, 10); 35 config->handler_context.output_config->y = strtol(*argv, &end, 10);
36 if (*end) { 36 if (*end) {
37 return cmd_results_new(CMD_INVALID, "output", 37 return cmd_results_new(CMD_INVALID, "output",