Ver Fonte

Catch invalid cursor positions

Jochen Sprickerhof há 5 anos atrás
pai
commit
a4faed60e3
1 ficheiros alterados com 3 adições e 0 exclusões
  1. 3 0
      scroll.c

+ 3 - 0
scroll.c

@@ -232,6 +232,9 @@ getcursorposition(int *x, int *y)
 
 	if (sscanf(input, "\033[%d;%dR", x, y) != 2)
 		die("parsing cursor position");
+
+	if (x <= 0 || y <= 0)
+		die("invalid cursor position");
 }
 
 void