_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
This commit is contained in:
Axel Dörfler
2004-08-13 17:45:54 +00:00
parent 8093fd8e2b
commit 7d1a7f96ff
+10 -6
View File
@@ -1,8 +1,8 @@
/* This file contains the debugger */ /* This file contains the debugger */
/* /*
** Copyright 2002-2004, The OpenBeOS Team. All rights reserved. ** Copyright 2002-2004, The Haiku Team. All rights reserved.
** Distributed under the terms of the OpenBeOS License. ** Distributed under the terms of the Haiku License.
** **
** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License. ** Distributed under the terms of the NewOS License.
@@ -537,14 +537,18 @@ dprintf(const char *fmt, ...)
void void
_user_debug_output(const char *userString) _user_debug_output(const char *userString)
{ {
char string[1024]; char string[512];
int32 length;
if (!sSerialDebugEnabled) if (!sSerialDebugEnabled)
return; return;
if (!IS_USER_ADDRESS(userString) if (!IS_USER_ADDRESS(userString))
|| user_strlcpy(string, userString, sizeof(string)) < B_OK)
return; 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));
} }