mscoree: Avoid buffer overflow when mono print handler returns huge string at once.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sebastian Lackner 2016-04-29 17:55:43 +02:00 committed by Alexandre Julliard
parent ce53cb4a00
commit e5404d4bf6
1 changed files with 7 additions and 1 deletions

View File

@ -272,7 +272,13 @@ static void CDECL mono_shutdown_callback_fn(MonoProfiler *prof)
static void CDECL mono_print_handler_fn(const char *string, INT is_stdout)
{
wine_dbg_printf("%s", string);
const char *p;
for (; *string; string = p)
{
if ((p = strstr(string, "\n"))) p++;
else p = string + strlen(string);
wine_dbg_printf("%.*s", (int)(p - string), string);
}
}
static HRESULT CLRRuntimeInfo_GetRuntimeHost(CLRRuntimeInfo *This, RuntimeHost **result)