aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2017-06-07 20:40:17 +0200
committerBoris Faure <billiob@gmail.com>2017-06-07 20:40:17 +0200
commit956f1eaa13a78617be6271b7b71b8f47f87c906c (patch)
tree761e034772ec494ab1bf4535dc01a4eb873812f5
parentafl-fuzz: spice up original test case (diff)
downloadterminology-956f1eaa13a78617be6271b7b71b8f47f87c906c.tar.gz
termptyesc: restrict right/bottom rectangle coordinates
-rw-r--r--src/bin/termptyesc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 284dd09..26211f9 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -857,6 +857,8 @@ _clean_up_rect_coordinates(Termpty *ty,
if (ty->termstate.right_margin && right >= ty->termstate.right_margin)
right = ty->termstate.right_margin;
}
+ if (right > ty->w)
+ right = ty->w;
if (bottom < 1)
bottom = ty->h;
@@ -867,6 +869,8 @@ _clean_up_rect_coordinates(Termpty *ty,
bottom = ty->termstate.bottom_margin - 1;
}
bottom--;
+ if (bottom > ty->h)
+ bottom = ty->h;
if ((bottom < top) || (right < left))
return -1;