From: Sebastian Lackner Subject: mscoree: Avoid buffer overflow when mono print handler returns huge string at once. Message-Id: <40d4f727-3b99-ac47-4cfb-acfc4b0583cc@fds-team.de> Date: Fri, 29 Apr 2016 17:55:43 +0200 Signed-off-by: Sebastian Lackner --- dlls/mscoree/metahost.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c index 252740d..30b9739 100644 --- a/dlls/mscoree/metahost.c +++ b/dlls/mscoree/metahost.c @@ -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) -- 2.8.0