Fix additional UAF in DirEntry building

This commit is contained in:
Michael Scire 2018-07-19 21:21:50 -06:00
parent a46e796f4d
commit eaa282b915

View file

@ -352,6 +352,11 @@ void RomFSBuildContext::Build(std::vector<RomFSSourceInfo> *out_infos) {
memset(cur_entry->name, 0, (cur_entry->name_size + 3) & ~3); memset(cur_entry->name, 0, (cur_entry->name_size + 3) & ~3);
memcpy(cur_entry->name, cur_dir->path + cur_dir->cur_path_ofs, name_size); memcpy(cur_entry->name, cur_dir->path + cur_dir->cur_path_ofs, name_size);
}
/* Delete directories. */
for (const auto &it : this->directories) {
cur_dir = it.second;
delete cur_dir->path; delete cur_dir->path;
delete cur_dir; delete cur_dir;
} }