From 32130635f623924f1aa19dda3054bab371d682b3 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Mon, 17 Dec 2012 10:28:20 -0800 Subject: [PATCH] Add NULL check to CallStack::toString CallStack::toString() has a 0 default argument, which ends up getting passed to strlen(), resulting in a crash. Change-Id: If706aff8c400983670f49cdbb66e11191ac76e0e --- libs/utils/CallStack.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/utils/CallStack.cpp b/libs/utils/CallStack.cpp index 18fd84f25..66fabebc4 100644 --- a/libs/utils/CallStack.cpp +++ b/libs/utils/CallStack.cpp @@ -118,7 +118,9 @@ String8 CallStack::toString(const char* prefix) const { char line[MAX_BACKTRACE_LINE_LENGTH]; format_backtrace_line(i, &mStack[i], &symbols[i], line, MAX_BACKTRACE_LINE_LENGTH); - str.append(prefix); + if (prefix) { + str.append(prefix); + } str.append(line); str.append("\n"); }