input: Fix check for mouse coordinates

Must check for EOF which will result in row/col being uninitialized.
This commit is contained in:
Thiago de Arruda 2015-01-15 08:58:14 -03:00
parent 7b537ffda9
commit 361c2290b6

View File

@ -233,7 +233,7 @@ static unsigned int handle_mouse_event(char **ptr, uint8_t *buf,
// find mouse coordinates, and it would be too expensive to refactor this
// now.
int col, row, advance;
if (sscanf(*ptr, "<%d,%d>%n", &col, &row, &advance)) {
if (sscanf(*ptr, "<%d,%d>%n", &col, &row, &advance) != EOF && advance) {
if (col >= 0 && row >= 0) {
mouse_row = row;
mouse_col = col;