mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-23 12:22:08 +00:00
fs.mitm: Fix UAF in every DirEntry processed.
How on earth did this code ever work?
This commit is contained in:
parent
3db9ce32fa
commit
a46e796f4d
1 changed files with 9 additions and 5 deletions
|
@ -332,11 +332,7 @@ void RomFSBuildContext::Build(std::vector<RomFSSourceInfo> *out_infos) {
|
||||||
default:
|
default:
|
||||||
fatalSimple(0xF601);
|
fatalSimple(0xF601);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete cur_file->path;
|
|
||||||
delete cur_file;
|
|
||||||
}
|
}
|
||||||
this->files.clear();
|
|
||||||
|
|
||||||
/* Populate dir tables. */
|
/* Populate dir tables. */
|
||||||
for (const auto &it : this->directories) {
|
for (const auto &it : this->directories) {
|
||||||
|
@ -362,6 +358,14 @@ void RomFSBuildContext::Build(std::vector<RomFSSourceInfo> *out_infos) {
|
||||||
this->root = NULL;
|
this->root = NULL;
|
||||||
this->directories.clear();
|
this->directories.clear();
|
||||||
|
|
||||||
|
/* Delete files. */
|
||||||
|
for (const auto &it : this->files) {
|
||||||
|
cur_file = it.second;
|
||||||
|
delete cur_file->path;
|
||||||
|
delete cur_file;
|
||||||
|
}
|
||||||
|
this->files.clear();
|
||||||
|
|
||||||
/* Set header fields. */
|
/* Set header fields. */
|
||||||
header->header_size = sizeof(*header);
|
header->header_size = sizeof(*header);
|
||||||
header->file_hash_table_size = this->file_hash_table_size;
|
header->file_hash_table_size = this->file_hash_table_size;
|
||||||
|
|
Loading…
Reference in a new issue