mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-27 03:33:33 +08:00
io: Fix use-after-free in ftw [BZ #26779]
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit ee52ab25ba
)
This commit is contained in:
parent
06afa5e09f
commit
deea6ab1bc
5
io/ftw.c
5
io/ftw.c
@ -324,8 +324,9 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp)
|
||||
buf[actsize++] = '\0';
|
||||
|
||||
/* Shrink the buffer to what we actually need. */
|
||||
data->dirstreams[data->actdir]->content = realloc (buf, actsize);
|
||||
if (data->dirstreams[data->actdir]->content == NULL)
|
||||
void *content = realloc (buf, actsize);
|
||||
data->dirstreams[data->actdir]->content = content;
|
||||
if (content == NULL)
|
||||
{
|
||||
int save_err = errno;
|
||||
free (buf);
|
||||
|
Loading…
Reference in New Issue
Block a user