blob: 813d9063ae4185a03bdc7c59d463ecbd72b0daa1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
From ee52ab25ba875f458981fce22c54e3c04c7a17d3 Mon Sep 17 00:00:00 2001
From: Martin Sebor <msebor@redhat.com>
Date: Tue, 25 Jan 2022 17:39:02 -0700
Subject: [PATCH] io: Fix use-after-free in ftw [BZ #26779]
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
---
io/ftw.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/io/ftw.c b/io/ftw.c
index 2742541f36..94bd5a93e4 100644
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -323,8 +323,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);
--
2.33.0
|