mirror of https://github.com/PCSX2/pcsx2.git
Debugger: Track remaining buffer size for snprintf to prevent fortify fail
This commit is contained in:
parent
deb8e5bf18
commit
112d02eaf5
|
@ -53,6 +53,7 @@ static void parseDisasm(SymbolMap& map, const char* disasm, char* opcode, char*
|
|||
return;
|
||||
}
|
||||
|
||||
char* arguments_start = arguments;
|
||||
const char* jumpAddress = strstr(disasm,"->$");
|
||||
const char* jumpRegister = strstr(disasm,"->");
|
||||
while (*disasm != 0)
|
||||
|
@ -66,9 +67,9 @@ static void parseDisasm(SymbolMap& map, const char* disasm, char* opcode, char*
|
|||
const std::string addressSymbol = map.GetLabelName(branchTarget);
|
||||
if (!addressSymbol.empty() && insertSymbols)
|
||||
{
|
||||
arguments += std::snprintf(arguments, arguments_size, "%s",addressSymbol.c_str());
|
||||
arguments += std::snprintf(arguments, arguments_size - (arguments - arguments_start), "%s",addressSymbol.c_str());
|
||||
} else {
|
||||
arguments += std::snprintf(arguments, arguments_size, "0x%08X",branchTarget);
|
||||
arguments += std::snprintf(arguments, arguments_size - (arguments - arguments_start), "0x%08X",branchTarget);
|
||||
}
|
||||
|
||||
disasm += 3+2+8;
|
||||
|
|
Loading…
Reference in New Issue