1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-06-29 06:56:44 +02:00

fix possible buffer overflows and undefined behaviour

This commit is contained in:
Jfreegman
2014-07-25 17:55:21 -04:00
parent fb5a9bc043
commit f630a3e604
6 changed files with 11 additions and 12 deletions

View File

@ -178,7 +178,7 @@ int complete_line(ToxWindow *self, const void *list, int n_items, int size)
int strt = ctx->pos - s_len;
int diff = m_len - s_len + n_endchrs;
if (ctx->len + diff > MAX_STR_SIZE)
if (ctx->len + diff >= MAX_STR_SIZE)
return -1;
char tmpend[MAX_STR_SIZE];
@ -220,7 +220,7 @@ static void complt_home_dir(ToxWindow *self, char *path)
int newlen = wcslen(wline);
if (ctx->len + newlen > MAX_STR_SIZE)
if (ctx->len + newlen >= MAX_STR_SIZE)
return;
wmemcpy(ctx->line, wline, newlen + 1);