Merge "libdebuggerd: fix out of bounds write."
am: eb1b202acb

Change-Id: Id3c0b0334fc50812c6e65b307db36977b7eb1150
diff --git a/debuggerd/libdebuggerd/tombstone.cpp b/debuggerd/libdebuggerd/tombstone.cpp
index 2b75292..af8072e 100644
--- a/debuggerd/libdebuggerd/tombstone.cpp
+++ b/debuggerd/libdebuggerd/tombstone.cpp
@@ -247,14 +247,13 @@
 
   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]);
 }