mscoree: Avoid buffer overflow when mono print handler returns huge string at once.
Sebastian Lackner
sebastian at fds-team.de
Fri Apr 29 10:55:43 CDT 2016
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---
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
More information about the wine-patches
mailing list