From 34450d70c5ba8efb20df14721507b1bf56e06f82 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Tue, 14 Mar 2017 20:43:43 -0700 Subject: [PATCH] Logd: Fix wrong parameters Better keep the right order, or ASAN will complain when you read out of bounds. Bug: 36234128 Test: m Test: m && m SANITIZE_TARGET=address Test: Sanitized device boots without ASAN crashes Change-Id: Ifc09cb0ece6835d2b636a3ad2128e09ca9aa45c9 --- logd/LogKlog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp index 9ae95f996..9dfa14ed3 100644 --- a/logd/LogKlog.cpp +++ b/logd/LogKlog.cpp @@ -754,7 +754,7 @@ int LogKlog::log(const char* buf, size_t len) { // eg: [143:healthd]healthd -> [143:healthd] taglen = etag - tag; // Mediatek-special printk induced stutter - const char* mp = strnrchr(tag, ']', taglen); + const char* mp = strnrchr(tag, taglen, ']'); if (mp && (++mp < etag)) { size_t s = etag - mp; if (((s + s) < taglen) && !fastcmp(mp, mp - 1 - s, s)) {