From 26ad5a00a3dc35dfea5180314088b209d6b272d6 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Fri, 25 Jul 2014 15:17:46 -0400 Subject: [PATCH] Fixed out of bounds read. --- src/input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/input.c b/src/input.c index f78685b..b061b7a 100644 --- a/src/input.c +++ b/src/input.c @@ -66,8 +66,8 @@ static void input_backspace(ToxWindow *self, int x, int mx_x) return; } - int cur_len = wcwidth(ctx->line[ctx->pos - 1]); - int s_len = wcwidth(ctx->line[ctx->start - 1]); + int cur_len = wcwidth(ctx->line[ctx->pos]); + int s_len = wcwidth(ctx->line[ctx->start]); if (ctx->start && (x >= mx_x - cur_len)) ctx->start = MAX(0, ctx->start - 1 + (s_len - cur_len));