hac2l: fix keys not working without newline at eof

This commit is contained in:
Michael Scire 2023-03-06 23:45:51 -07:00
parent 402231eb3d
commit 3048cde118
2 changed files with 5 additions and 2 deletions

View File

@ -470,7 +470,7 @@ namespace ams::hactool {
}
/* Allocate buffer for the file. */
auto buf = std::make_unique<char[]>(file_size);
auto buf = std::make_unique<char[]>(file_size + 1);
if (buf == nullptr) {
fprintf(stderr, "[Warning]: failed to allocate memory for key file (%s)\n", path);
return;
@ -482,6 +482,9 @@ namespace ams::hactool {
return;
}
/* Null-terminate the file contents. */
buf[file_size] = '\x00';
ProcessKeyValueFile(path, buf.get(), file_size, f);
}

View File

@ -156,7 +156,7 @@ namespace ams::hactool {
}
if (m_has_base_pfs && !m_base_pfs_ctx.is_exefs) {
m_has_base_xci = false;
m_has_base_pfs = false;
GetBaseFromAppFs(m_base_pfs_ctx.app_ctx, "basepfs");
m_has_base_pfs = true;
}