From 7d1a7f96ffd33e2d6771ba7a6c8cf4bed58c163d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 13 Aug 2004 17:45:54 +0000 Subject: [PATCH] _kern_debug_output() no longer accidently accesses unsafe user memory. It now accepts strings of any size, reduced the stack consumption. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8559 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/debug.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/kernel/core/debug.c b/src/kernel/core/debug.c index da7150247b..72c753e184 100644 --- a/src/kernel/core/debug.c +++ b/src/kernel/core/debug.c @@ -1,8 +1,8 @@ /* This file contains the debugger */ /* -** Copyright 2002-2004, The OpenBeOS Team. All rights reserved. -** Distributed under the terms of the OpenBeOS License. +** Copyright 2002-2004, The Haiku Team. All rights reserved. +** Distributed under the terms of the Haiku License. ** ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. @@ -537,14 +537,18 @@ dprintf(const char *fmt, ...) void _user_debug_output(const char *userString) { - char string[1024]; + char string[512]; + int32 length; if (!sSerialDebugEnabled) return; - if (!IS_USER_ADDRESS(userString) - || user_strlcpy(string, userString, sizeof(string)) < B_OK) + if (!IS_USER_ADDRESS(userString)) return; - dbg_puts(userString); + do { + length = user_strlcpy(string, userString, sizeof(string)); + dbg_puts(string); + userString += sizeof(string) - 1; + } while (length >= (ssize_t)sizeof(string)); }