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); }