[CRIU] [PATCH 1/8] sysfs: fix use_after_free issue
Andrey Vagin
avagin at openvz.org
Fri Oct 31 07:50:43 PDT 2014
CID 73379 (#1 of 1): Use after free (USE_AFTER_FREE)
31. deref_arg: Calling fclose dereferences freed pointer fp.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
sysfs_parse.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sysfs_parse.c b/sysfs_parse.c
index 4681547..9b81463 100644
--- a/sysfs_parse.c
+++ b/sysfs_parse.c
@@ -211,8 +211,9 @@ int parse_aufs_branches(struct mount_info *mi)
* Now read branch pathnames from the branch files.
*/
n = strlen(path);
- fp = NULL;
for (br_num = 0; br_num <= br_max; br_num++) {
+ fp = NULL;
+
ret = snprintf(&path[n], sizeof path - n, "/br%d", br_num);
if (ret >= sizeof path - n) {
pr_err("Buffer overrun creating path for branch %d\n", br_num);
--
1.9.3
More information about the CRIU
mailing list