pcsx2:debugger: Fix potential buffer overrun

CID 146914 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)

The overflow can be triggered using the Debugger's Rename Function
feature.
This commit is contained in:
Jonathan Li 2015-09-13 23:39:35 +01:00
parent 39c5cd4f84
commit b0803a4bc6
1 changed files with 2 additions and 2 deletions

View File

@ -576,8 +576,8 @@ void SymbolMap::SetLabelName(const char* name, u32 address, bool updateImmediate
auto symbolKey = std::make_pair(labelInfo->second.module, labelInfo->second.addr);
auto label = labels.find(symbolKey);
if (label != labels.end()) {
strcpy(label->second.name,name);
label->second.name[127] = 0;
strncpy(label->second.name, name, ARRAY_SIZE(label->second.name));
label->second.name[ARRAY_SIZE(label->second.name) - 1] = 0;
// Allow the caller to skip this as it causes extreme startup slowdown
// when this gets called for every function identified by the function replacement code.