mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-01 02:03:47 +01:00
Properly clamp some iterative snprintf()s.
This commit is contained in:
1 parent
ebb9f68c3e
commit
fba0110073
3 files changed
+13
-13
No files matched your search
@@ -905,12 +905,12 @@ void CtrlDisAsmView::copyInstructions(u32 startAddr, u32 endAddr, bool withDisas
|
||||
char *temp = new char[space];
|
||||
|
||||
char *p = temp, *end = temp + space;
|
||||
for (u32 pos = startAddr; pos < endAddr; pos += instructionSize)
|
||||
for (u32 pos = startAddr; pos < endAddr && p < end; pos += instructionSize)
|
||||
{
|
||||
p += snprintf(p, end - p, "%08X", debugger->readMemory(pos));
|
||||
|
||||
// Don't leave a trailing newline.
|
||||
if (pos + instructionSize < endAddr)
|
||||
if (pos + instructionSize < endAddr && p < end)
|
||||
p += snprintf(p, end - p, "\r\n");
|
||||
}
|
||||
W32Util::CopyTextToClipboard(wnd, temp);
|
||||
|
||||
Reference in new issue
Block a user