mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 02:03:02 +01:00
Fixed out of bounds read.
This commit is contained in:
parent
18e1f08e31
commit
26ad5a00a3
@ -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));
|
||||||
|
Loading…
Reference in New Issue
Block a user