From b1c3379c7e17a5368f3ce6642e3e995143779481 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 11 Sep 2013 04:43:47 +0200 Subject: [PATCH] _user_debug_output(): Fix for long strings The wrong length was passed to debug_puts(). --- src/system/kernel/debug/debug.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/system/kernel/debug/debug.cpp b/src/system/kernel/debug/debug.cpp index caa90d1311..15adaba629 100644 --- a/src/system/kernel/debug/debug.cpp +++ b/src/system/kernel/debug/debug.cpp @@ -2268,13 +2268,15 @@ _user_debug_output(const char* userString) char string[512]; int32 length; + int32 toWrite; do { length = user_strlcpy(string, userString, sizeof(string)); if (length <= 0) break; - debug_puts(string, length); - userString += sizeof(string) - 1; - } while (length >= (ssize_t)sizeof(string)); + toWrite = std::min(length, (int32)sizeof(string) - 1); + debug_puts(string, toWrite); + userString += toWrite; + } while (length > toWrite); }