mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 01:03:41 +01:00
Terminate the loop early if it's going to overflow; there's no reason to keep riding it out. Also fix use of uninitialized variable.
This commit is contained in:
1 parent
2e25f00585
commit
f70faaa0c2
1 file changed
+3
-1
@@ -174,11 +174,13 @@ void GetWideStringFromPSPPointer(std::wstring& _string, const PSPPointer<u16_le>
|
||||
|
||||
auto input = em_address;
|
||||
int c;
|
||||
u32_le count;
|
||||
u32_le count = 0;
|
||||
while ((c = *input++) != 0)
|
||||
{
|
||||
if ( !(++count >= maxLength) )
|
||||
*string++ = c;
|
||||
else
|
||||
break;
|
||||
}
|
||||
*string++ = '\0';
|
||||
_string = stringBuffer;
|
||||
|
||||
Reference in new issue
Block a user