mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-12-29 14:46:49 +00:00
filesys/ncch: prevent buffer overflow on calculating SHA256
This commit is contained in:
parent
a59920ed35
commit
5179915fb4
|
@ -179,7 +179,9 @@ Loader::ResultStatus NCCHContainer::Load() {
|
||||||
std::memcpy(input.data(), key_y_primary.data(), key_y_primary.size());
|
std::memcpy(input.data(), key_y_primary.data(), key_y_primary.size());
|
||||||
std::memcpy(input.data() + key_y_primary.size(), seed.data(), seed.size());
|
std::memcpy(input.data() + key_y_primary.size(), seed.data(), seed.size());
|
||||||
CryptoPP::SHA256 sha;
|
CryptoPP::SHA256 sha;
|
||||||
sha.CalculateDigest(key_y_secondary.data(), input.data(), input.size());
|
std::array<u8, CryptoPP::SHA256::DIGESTSIZE> hash;
|
||||||
|
sha.CalculateDigest(hash.data(), input.data(), input.size());
|
||||||
|
std::memcpy(key_y_secondary.data(), hash.data(), key_y_secondary.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue