package.mk/wip/mdadm/fix-use-after-free.patch

21 lines
556 B
Diff
Raw Normal View History

From Rich Felker.
Fixed upstream in:
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/policy.c?id=cd72f9d114da206baa01fd56ff2d8ffcc08f3239
diff --git a/policy.c b/policy.c
index c0d18a7e..78ad34cd 100644
--- a/policy.c
+++ b/policy.c
@@ -214,8 +214,9 @@ static char *disk_path(struct mdinfo *disk)
continue;
if (stb.st_rdev != makedev(disk->disk.major, disk->disk.minor))
continue;
+ char *result = xstrdup(ent->d_name);
closedir(by_path);
- return xstrdup(ent->d_name);
+ return result;
}
closedir(by_path);
}