_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

View File

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