1
0
Fork 0

Merge pull request #3627 from d2k2-git/use-GUI_MAX_DISASSEMBLY_SIZE

align char buffer sizes with defined limit in GuiGetDisassembly
This commit is contained in:
Duncan Ogilvie 2025-07-21 13:31:31 +02:00 committed by GitHub
commit eda7c3296b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 9 deletions

View File

@ -219,7 +219,7 @@ bool cbInstrFindAll(int argc, char* argv[])
break;
i += foundoffset + 1;
result = addr + i - 1;
char msg[deflen] = "";
char msg[GUI_MAX_DISASSEMBLY_SIZE] = "";
sprintf_s(msg, "%p", (void*)result);
GuiReferenceSetRowCount(refCount + 1);
GuiReferenceSetCellContent(refCount, 0, msg);
@ -327,15 +327,15 @@ bool cbInstrFindAllMem(int argc, char* argv[])
}
}
if (
if(
(page.address <= addr && addr < page.address + page.size) ||
(addr <= page.address && page.address < addr + find_size)
)
)
{
// One (partially or fully) overlaps the other
searchPages.push_back(page);
}
else if (find_size == -1 && addr <= page.address)
else if(find_size == -1 && addr <= page.address)
{
// Not overlapping, but past the address
searchPages.push_back(page);
@ -366,12 +366,12 @@ bool cbInstrFindAllMem(int argc, char* argv[])
int refCount = 0;
for(duint result : results)
{
if ((result < addr) || ((find_size != -1) && (addr + find_size <= (result + searchpattern.size()))))
if((result < addr) || ((find_size != -1) && (addr + find_size <= (result + searchpattern.size()))))
{
continue;
}
char msg[deflen] = "";
char msg[GUI_MAX_DISASSEMBLY_SIZE] = "";
sprintf_s(msg, "%p", (void*)result);
GuiReferenceSetRowCount(refCount + 1);
GuiReferenceSetCellContent(refCount, 0, msg);
@ -623,7 +623,7 @@ static bool cbRefStr(Zydis* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO*
sprintf_s(strAddrText, "%p", (void*)strAddr);
GuiReferenceSetRowCount(refinfo->refcount + 1);
GuiReferenceSetCellContent(refinfo->refcount, 0, addrText);
char disassembly[4096] = "";
char disassembly[GUI_MAX_DISASSEMBLY_SIZE] = "";
if(GuiGetDisassembly((duint)disasm->Address(), disassembly))
GuiReferenceSetCellContent(refinfo->refcount, 1, disassembly);
else
@ -668,7 +668,7 @@ static bool cbRefFuncPtr(Zydis* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFIN
sprintf_s(addrText, "%p", (void*)(duint)disasm->Address());
GuiReferenceSetRowCount(refinfo->refcount + 1);
GuiReferenceSetCellContent(refinfo->refcount, 0, addrText);
char disassembly[4096] = "";
char disassembly[GUI_MAX_DISASSEMBLY_SIZE] = "";
if(GuiGetDisassembly((duint)disasm->Address(), disassembly))
GuiReferenceSetCellContent(refinfo->refcount, 1, disassembly);
else
@ -1010,7 +1010,7 @@ static bool cbGUIDFind(Zydis* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO
sprintf_s(addrText, "%p", (void*)(duint)disasm->Address());
GuiReferenceSetRowCount(refinfo->refcount + 1);
GuiReferenceSetCellContent(refinfo->refcount, 0, addrText);
char disassembly[4096] = "";
char disassembly[GUI_MAX_DISASSEMBLY_SIZE] = "";
if(GuiGetDisassembly((duint)disasm->Address(), disassembly))
GuiReferenceSetCellContent(refinfo->refcount, 1, disassembly);
else