mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-28 08:43:38 +01:00
Prevent possible buffer overflow.
This commit is contained in:
1 parent
05b860c167
commit
58ca962d89
1 file changed
+3
-2
@@ -162,13 +162,14 @@ void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16_
|
||||
|
||||
void GetWideStringFromPSPPointer(std::wstring& _string, const PSPPointer<u16_le> em_address)
|
||||
{
|
||||
if (!em_address.IsValid())
|
||||
const size_t maxLength = 2048;
|
||||
if (!em_address.IsValid() || _string.length() >= maxLength)
|
||||
{
|
||||
_string = L"";
|
||||
return;
|
||||
}
|
||||
|
||||
wchar_t stringBuffer[2048];
|
||||
wchar_t stringBuffer[maxLength];
|
||||
wchar_t *string = stringBuffer;
|
||||
|
||||
auto input = em_address;
|
||||
|
||||
Reference in new issue
Block a user