aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2016-11-15 22:28:27 +0100
committerBoris Faure <billiob@gmail.com>2016-11-15 22:28:27 +0100
commitcea49794a032404a4825ccc76ee168ee004ccff3 (patch)
tree5f78b3ed47fbef0dc6476a5f10fcddaa7b3556ea
parenttermio: elm_layout_add() expects and elm widget (diff)
downloadterminology-cea49794a032404a4825ccc76ee168ee004ccff3.tar.gz
termiolink: hopefully fixes segfault. Closes https://phab.enlightenment.org/T4896
-rw-r--r--src/bin/termiolink.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bin/termiolink.c b/src/bin/termiolink.c
index a54763d..a69c7d6 100644
--- a/src/bin/termiolink.c
+++ b/src/bin/termiolink.c
@@ -73,6 +73,8 @@ _txt_at(Termpty *ty, int *x, int *y, char *txt, int *txtlenp)
cells = termpty_cellrow_get(ty, *y, &w);
if (!cells || !w)
goto bad;
+ if ((*x >= w))
+ *x = w-1;
cell = cells[*x];
if ((cell.codepoint == 0) && (cell.att.dblwidth))
{
@@ -113,7 +115,7 @@ _txt_prev_at(Termpty *ty, int *x, int *y, char *txt, int *txtlenp)
cells = termpty_cellrow_get(ty, *y, &w);
if (!cells || !w)
goto bad;
- if ((*x) < 0)
+ if (((*x) < 0) || ((*x) >= w))
*x = w-1;
cell = cells[*x];