mirror of
https://github.com/tmux/tmux.git
synced 2026-04-06 07:38:33 +00:00
Don't just resize buffer once, repeat until it is big enough. Also use
reallocarray. Reported by tuannguyenduc228 at gmail dot com.
This commit is contained in:
@@ -487,9 +487,9 @@ static void
|
||||
sixel_print_add(char **buf, size_t *len, size_t *used, const char *s,
|
||||
size_t slen)
|
||||
{
|
||||
if (*used + slen >= *len + 1) {
|
||||
while (*used + slen >= *len + 1) {
|
||||
*buf = xreallocarray(*buf, 2, *len);
|
||||
(*len) *= 2;
|
||||
*buf = xrealloc(*buf, *len);
|
||||
}
|
||||
memcpy(*buf + *used, s, slen);
|
||||
(*used) += slen;
|
||||
|
||||
Reference in New Issue
Block a user