Skip to content

Commit 388d5a0

Browse files
committed
DBG: resolved issue x64dbg#194 (very stupid stack overflow in _dbg_addrinfoget)
1 parent 6b67cde commit 388d5a0

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

x64_dbg_dbg/_exports.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,8 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
8787
bool retval = false;
8888
if(addrinfo->flags & flagmodule) //get module
8989
{
90-
char module[64] = "";
91-
if(modnamefromaddr(addr, module, false) and strlen(module) < MAX_MODULE_SIZE) //get module name
92-
{
93-
strcpy(addrinfo->module, module);
90+
if(modnamefromaddr(addr, addrinfo->module, false)) //get module name
9491
retval = true;
95-
}
9692
}
9793
if(addrinfo->flags & flaglabel)
9894
{

x64_dbg_dbg/addrinfo.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,10 @@ bool modnamefromaddr(uint addr, char* modname, bool extension)
244244
const ModulesInfo::iterator found = modinfo.find(Range(addr, addr));
245245
if(found == modinfo.end()) //not found
246246
return false;
247-
strcpy(modname, found->second.name);
247+
String mod = found->second.name;
248248
if(extension)
249-
strcat(modname, found->second.extension); //append extension
249+
mod += found->second.extension;
250+
strcpy_s(modname, MAX_MODULE_SIZE, mod.c_str());
250251
return true;
251252
}
252253

0 commit comments

Comments
 (0)