Merge "liblog: print message payload of zero length"

am: 50413c7626

* commit '50413c7626c7598ccb062d7d1156e5cfa1b2cb8e':
  liblog: print message payload of zero length
This commit is contained in:
Mark Salyzyn 2015-12-08 00:31:59 +00:00 committed by android-build-merger
commit e13efa6112
1 changed files with 2 additions and 2 deletions

View File

@ -500,14 +500,14 @@ int android_log_processLogBuffer(struct logger_entry *buf,
}
if (msgEnd == -1) {
/* incoming message not null-terminated; force it */
msgEnd = buf->len - 1;
msgEnd = buf->len - 1; /* may result in msgEnd < msgStart */
msg[msgEnd] = '\0';
}
entry->priority = msg[0];
entry->tag = msg + 1;
entry->message = msg + msgStart;
entry->messageLen = msgEnd - msgStart;
entry->messageLen = (msgEnd < msgStart) ? 0 : (msgEnd - msgStart);
return 0;
}