From 23a1bcf28bc3dd1e5ded670513e4339ae6ea7540 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 4 Apr 2015 10:34:07 +0200 Subject: [PATCH] gcc2 demangler: Fix skip of string termination. The inner loop to skip the function declaration stops at the terminating null but didn't break out of the loop in that case, causing the outer loop increment to skip the terminator and read beyond the string end. Well formatted symbols do not trigger this, but there sometimes are false positives that would cause it to happen. It was seen in Debugger that reuses this code. --- src/add-ons/kernel/debugger/demangle/gcc2.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/add-ons/kernel/debugger/demangle/gcc2.cpp b/src/add-ons/kernel/debugger/demangle/gcc2.cpp index 6b9e73b8d6..a35a292388 100644 --- a/src/add-ons/kernel/debugger/demangle/gcc2.cpp +++ b/src/add-ons/kernel/debugger/demangle/gcc2.cpp @@ -43,6 +43,9 @@ ignore_qualifiers(const char** _arg) // skip function declaration while (**_arg && **_arg != '_') (*_arg)++; + + if (**_arg == 0) + break; } (*_arg)++;