diff options
| author | 2022-10-21 03:47:02 -0400 | |
|---|---|---|
| committer | 2022-10-21 03:47:02 -0400 | |
| commit | efaedcab312b4ead2757bd5f06d3e57688d61cd4 (patch) | |
| tree | 995ae08f705b60810339db1041f090139cd15e99 | |
| parent | Merge pull request #9108 from Morph1984/r32-b24g8 (diff) | |
| parent | hid/npad: Fix copy size in GetSupportedNpadIdTypes (diff) | |
| download | yuzu-efaedcab312b4ead2757bd5f06d3e57688d61cd4.tar.gz yuzu-efaedcab312b4ead2757bd5f06d3e57688d61cd4.tar.xz yuzu-efaedcab312b4ead2757bd5f06d3e57688d61cd4.zip | |
Merge pull request #9106 from lioncash/copy-err
hid/npad: Fix copy size in GetSupportedNpadIdTypes
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 98e4f2af7..ba8a1f786 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -745,8 +745,9 @@ void Controller_NPad::SetSupportedNpadIdTypes(u8* data, std::size_t length) { | |||
| 745 | } | 745 | } |
| 746 | 746 | ||
| 747 | void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) { | 747 | void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) { |
| 748 | ASSERT(max_length < supported_npad_id_types.size()); | 748 | const auto copy_amount = supported_npad_id_types.size() * sizeof(u32); |
| 749 | std::memcpy(data, supported_npad_id_types.data(), supported_npad_id_types.size()); | 749 | ASSERT(max_length <= copy_amount); |
| 750 | std::memcpy(data, supported_npad_id_types.data(), copy_amount); | ||
| 750 | } | 751 | } |
| 751 | 752 | ||
| 752 | std::size_t Controller_NPad::GetSupportedNpadIdTypesSize() const { | 753 | std::size_t Controller_NPad::GetSupportedNpadIdTypesSize() const { |