mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-26 13:52:21 +00:00
Fix memory corruption in romfs build (closes #708)
This commit is contained in:
parent
7e6ff1f327
commit
889ea5e5aa
1 changed files with 6 additions and 2 deletions
|
@ -371,8 +371,10 @@ namespace ams::mitm::fs {
|
|||
/* Set name. */
|
||||
cur_entry->name_size = name_size;
|
||||
if (name_size) {
|
||||
std::memset(cur_entry->name + util::AlignDown(name_size, 4), 0, 4);
|
||||
std::memcpy(cur_entry->name, cur_file->path.get() + cur_file->cur_path_ofs, name_size);
|
||||
for (size_t i = name_size; i < util::AlignUp(name_size, 4); i++) {
|
||||
cur_entry->name[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Emplace a source. */
|
||||
|
@ -418,8 +420,10 @@ namespace ams::mitm::fs {
|
|||
/* Set name. */
|
||||
cur_entry->name_size = name_size;
|
||||
if (name_size) {
|
||||
std::memset(cur_entry->name + util::AlignDown(name_size, 4), 0, 4);
|
||||
std::memcpy(cur_entry->name, cur_dir->path.get() + cur_dir->cur_path_ofs, name_size);
|
||||
for (size_t i = name_size; i < util::AlignUp(name_size, 4); i++) {
|
||||
cur_entry->name[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue