diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp index da5e78d66..2a3f52f99 100644 --- a/logd/LogKlog.cpp +++ b/logd/LogKlog.cpp @@ -582,7 +582,7 @@ int LogKlog::log(const char *buf, size_t len) { // Some may view the following as an ugly heuristic, the desire is to // beautify the kernel logs into an Android Logging format; the goal is // admirable but costly. - while ((isspace(*p) || !*p) && (p < &buf[len])) { + while ((p < &buf[len]) && (isspace(*p) || !*p)) { ++p; } if (p >= &buf[len]) { // timestamp, no content @@ -596,7 +596,7 @@ int LogKlog::log(const char *buf, size_t len) { const char *bt, *et, *cp; bt = p; - if (!fast(p, "[INFO]", 6)) { + if ((taglen >= 6) && !fast(p, "[INFO]", 6)) { // [