summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2013-02-06 13:08:58 -0800
committerAaron Plattner <aplattner@nvidia.com>2013-02-12 12:29:09 -0800
commit0a26e076e10a3c7461d59c830cdc10688d66824f (patch)
treee25590a3fd305c693d077adcc5344ab8e0a0a0b3
parent138b6252c0cae6599b6c8a25ffa22ffe70f227c2 (diff)
Bug #11397: check that numeric --orientation arguments are in range
The only valid parameters to -o (--orientation) are 0, 1, 2, 3, normal, left, inverted, and right. xrandr converts the strings to numbers and then checks that they're within range, but doesn't validate them if it was numeric to begin with. Move the range check outside of the if statement so that out-of-range numeric values are rejected properly. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Daniel Dadap <ddadap@nvidia.com>
-rw-r--r--xrandr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/xrandr.c b/xrandr.c
index b0e8cec..926bc68 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -2579,8 +2579,8 @@ main (int argc, char **argv)
for (dirind = 0; dirind < 4; dirind++) {
if (strcmp (direction[dirind], argv[i]) == 0) break;
}
- if ((dirind < 0) || (dirind > 3)) usage();
}
+ if ((dirind < 0) || (dirind > 3)) usage();
rot = dirind;
setit = True;
action_requested = True;