1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 06:13:03 +01:00

Fixed out of bounds read.

This commit is contained in:
irungentoo 2014-07-25 15:17:46 -04:00
parent 18e1f08e31
commit 26ad5a00a3

View File

@ -66,8 +66,8 @@ static void input_backspace(ToxWindow *self, int x, int mx_x)
return; return;
} }
int cur_len = wcwidth(ctx->line[ctx->pos - 1]); int cur_len = wcwidth(ctx->line[ctx->pos]);
int s_len = wcwidth(ctx->line[ctx->start - 1]); int s_len = wcwidth(ctx->line[ctx->start]);
if (ctx->start && (x >= mx_x - cur_len)) if (ctx->start && (x >= mx_x - cur_len))
ctx->start = MAX(0, ctx->start - 1 + (s_len - cur_len)); ctx->start = MAX(0, ctx->start - 1 + (s_len - cur_len));