From 3b4d427993fe8df5ea531169590aecf7be868870 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sun, 1 Aug 2021 11:59:52 -0400 Subject: [PATCH] service: set: Correct copy amount in GetAvailableLanguageCodes --- src/core/hle/service/set/set.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index f2e2e8306..8795eb6b7 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp @@ -85,7 +85,8 @@ void PushResponseLanguageCode(Kernel::HLERequestContext& ctx, std::size_t num_la void GetAvailableLanguageCodesImpl(Kernel::HLERequestContext& ctx, std::size_t max_entries) { const std::size_t requested_amount = ctx.GetWriteBufferSize() / sizeof(LanguageCode); - const std::size_t copy_amount = std::min(requested_amount, max_entries); + const std::size_t max_amount = std::min(requested_amount, max_entries); + const std::size_t copy_amount = std::min(available_language_codes.size(), max_amount); const std::size_t copy_size = copy_amount * sizeof(LanguageCode); ctx.WriteBuffer(available_language_codes.data(), copy_size);