fix regression from android_lookupEventTag_len()
Commit 807e40ecc9786755e2f74a7a6a9b20c812588119 'liblog: logd: Add
android_lookupEventTag_len()' which addressed a Dirty Shared memory
leak resulted in a regression. Most notably logcat <tag> stopped
working for the events log buffer.
AndroidLogEntry::tag also requires callers to check out
AndroidLogEntry::tagLen as tag is no longer guaranteed to be
nul terminated.
Test: logcat-unit-tests --gtest_filter=logcat.event_tag_filter
Bug: 31456426
Change-Id: Ibe5236131b640eb5b7e3df0ab4b5f3e25b85ad45
diff --git a/debuggerd/tombstone.cpp b/debuggerd/tombstone.cpp
index 459e4cc..1e47483 100644
--- a/debuggerd/tombstone.cpp
+++ b/debuggerd/tombstone.cpp
@@ -576,9 +576,9 @@
AndroidLogEntry e;
char buf[512];
android_log_processBinaryLogBuffer(entry, &e, g_eventTagMap, buf, sizeof(buf));
- _LOG(log, logtype::LOGS, "%s.%03d %5d %5d %c %-8s: %s\n",
+ _LOG(log, logtype::LOGS, "%s.%03d %5d %5d %c %-8.*s: %s\n",
timeBuf, entry->nsec / 1000000, entry->pid, entry->tid,
- 'I', e.tag, e.message);
+ 'I', (int)e.tagLen, e.tag, e.message);
continue;
}