libdebuggerd: fix out of bounds write.
Bug: http://b/78363964 Test: treehugger Change-Id: I79ae818e4e0c29f064335d59789afc3b1bf87c69
This commit is contained in:
parent
5d1c14f41b
commit
83b8ac24b6
1 changed files with 2 additions and 3 deletions
|
|
@ -247,14 +247,13 @@ static void dump_abort_message(log_t* log, Memory* process_memory, uint64_t addr
|
|||
|
||||
length -= sizeof(size_t);
|
||||
|
||||
std::vector<char> msg(length);
|
||||
// The abort message should be null terminated already, but reserve a spot for NUL just in case.
|
||||
std::vector<char> msg(length + 1);
|
||||
if (!process_memory->ReadFully(address + sizeof(length), &msg[0], length)) {
|
||||
_LOG(log, logtype::HEADER, "Failed to read abort message: %s\n", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
// The abort message should be null terminated already, but just in case...
|
||||
msg[length] = '\0';
|
||||
_LOG(log, logtype::HEADER, "Abort message: '%s'\n", &msg[0]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue