diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/lm/lm.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index 4e0b4ea09..90e9e691a 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp | |||
| @@ -162,9 +162,11 @@ private: | |||
| 162 | if (length == 0) { | 162 | if (length == 0) { |
| 163 | return std::nullopt; | 163 | return std::nullopt; |
| 164 | } | 164 | } |
| 165 | std::string output(length, '\0'); | 165 | const auto length_to_read = std::min(length, data.size() - offset); |
| 166 | std::memcpy(output.data(), data.data() + offset, length); | 166 | |
| 167 | offset += length; | 167 | std::string output(length_to_read, '\0'); |
| 168 | std::memcpy(output.data(), data.data() + offset, length_to_read); | ||
| 169 | offset += length_to_read; | ||
| 168 | return output; | 170 | return output; |
| 169 | } | 171 | } |
| 170 | 172 | ||