Explorar o código

Catch invalid cursor positions

Jochen Sprickerhof %!s(int64=5) %!d(string=hai) anos
pai
achega
a4faed60e3
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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