[core] Fix logcat tag len (#1022)

It's an ASOP's bug that tag len is 1 larger
This commit is contained in:
LoveSy 2021-08-28 13:53:45 +08:00 committed by GitHub
parent 4eeadd02d6
commit 4c4dda340a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -115,6 +115,10 @@ void Logcat::ProcessBuffer(struct log_msg *buf) {
AndroidLogEntry entry; AndroidLogEntry entry;
if (android_log_processLogBuffer(&buf->entry, &entry) < 0) return; if (android_log_processLogBuffer(&buf->entry, &entry) < 0) return;
if (entry.tagLen >= 1 && entry.tag[entry.tagLen - 1] == '\0') [[likely]] {
--entry.tagLen;
}
std::string_view tag(entry.tag, entry.tagLen); std::string_view tag(entry.tag, entry.tagLen);
bool shortcut = false; bool shortcut = false;
if (tag == "LSPosed-Bridge"sv || tag == "XSharedPreferences"sv) [[unlikely]] { if (tag == "LSPosed-Bridge"sv || tag == "XSharedPreferences"sv) [[unlikely]] {