debugger: enforce a null terminated char of a C-string

CID 146728 (#1 of 1): Buffer not null terminated (BUFFER_SIZE_WARNING)
buffer_size_warning: Calling strncpy with a maximum size argument of 128 bytes on destination array mod.name of size 128 bytes might leave the destination string unterminated
This commit is contained in:
Gregory Hainaut 2015-09-10 14:21:47 +02:00
parent b082147c4d
commit 1baa6be6de
1 changed files with 1 additions and 0 deletions

View File

@ -241,6 +241,7 @@ void SymbolMap::AddModule(const char *name, u32 address, u32 size) {
ModuleEntry mod; ModuleEntry mod;
strncpy(mod.name, name, ARRAY_SIZE(mod.name)); strncpy(mod.name, name, ARRAY_SIZE(mod.name));
mod.name[ARRAY_SIZE(mod.name) - 1] = 0;
mod.start = address; mod.start = address;
mod.size = size; mod.size = size;
mod.index = (int)modules.size() + 1; mod.index = (int)modules.size() + 1;