Skip to content

Commit 18d52bf

Browse files
authored
Merge pull request #307 from lxylxy123456/master
Fix buffer overflow in "ydotool mousemove"
2 parents b0c5da3 + b4ea507 commit 18d52bf

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Client/tool_mousemove.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,18 @@ int tool_mousemove(int argc, char **argv) {
107107
is_wheel = 1;
108108
break;
109109
case 'x':
110+
if (i >= 2) {
111+
show_help();
112+
return 1;
113+
}
110114
pos[0] = strtol(optarg, NULL, 10);
111115
i++;
112116
break;
113117
case 'y':
118+
if (i >= 2) {
119+
show_help();
120+
return 1;
121+
}
114122
pos[1] = strtol(optarg, NULL, 10);
115123
i++;
116124
break;
@@ -128,6 +136,10 @@ int tool_mousemove(int argc, char **argv) {
128136

129137
if (optind < argc) {
130138
while (optind < argc) {
139+
if (i >= 2) {
140+
show_help();
141+
return 1;
142+
}
131143
pos[i] = strtol(argv[optind++], NULL, 10);
132144
i++;
133145
}

0 commit comments

Comments
 (0)