From 4c4dda340aedf92f47fb32fe14e91bb82a8e6cbe Mon Sep 17 00:00:00 2001 From: LoveSy Date: Sat, 28 Aug 2021 13:53:45 +0800 Subject: [PATCH] [core] Fix logcat tag len (#1022) It's an ASOP's bug that tag len is 1 larger --- core/src/main/cpp/daemon/logcat.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/src/main/cpp/daemon/logcat.cpp b/core/src/main/cpp/daemon/logcat.cpp index 95b9ac01..ce8eda94 100644 --- a/core/src/main/cpp/daemon/logcat.cpp +++ b/core/src/main/cpp/daemon/logcat.cpp @@ -115,6 +115,10 @@ void Logcat::ProcessBuffer(struct log_msg *buf) { AndroidLogEntry entry; 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); bool shortcut = false; if (tag == "LSPosed-Bridge"sv || tag == "XSharedPreferences"sv) [[unlikely]] {