mirror of
https://github.com/tmux/tmux.git
synced 2026-07-16 14:01:16 +00:00
fix(compat): guard buffer size multiplication in getline
This commit is contained in:
@@ -74,8 +74,14 @@ getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp)
|
||||
}
|
||||
if (ptr + 2 >= eptr) {
|
||||
char *nbuf;
|
||||
size_t nbufsiz = *bufsiz * 2;
|
||||
size_t nbufsiz;
|
||||
ssize_t d = ptr - *buf;
|
||||
|
||||
if (*bufsiz > SIZE_MAX / 2) {
|
||||
errno = EOVERFLOW;
|
||||
return -1;
|
||||
}
|
||||
nbufsiz = *bufsiz * 2;
|
||||
if ((nbuf = realloc(*buf, nbufsiz)) == NULL)
|
||||
return -1;
|
||||
*buf = nbuf;
|
||||
|
||||
Reference in New Issue
Block a user