From da323447308280c736ac44946fce752a5dca8243 Mon Sep 17 00:00:00 2001 From: huxingyi Date: Thu, 24 Oct 2013 16:10:44 +0800 Subject: [PATCH] fs-event: fix invalid memory access file_info->FileName is not null terminated. --- src/win/fs-event.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/win/fs-event.c b/src/win/fs-event.c index 1954cb09..e1f79abd 100644 --- a/src/win/fs-event.c +++ b/src/win/fs-event.c @@ -339,7 +339,8 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req, uv_fatal_error(ERROR_OUTOFMEMORY, "malloc"); } - _snwprintf(filenamew, size, L"%s\\%s", handle->dirw, + _snwprintf(filenamew, size, L"%s\\%.*s", handle->dirw, + file_info->FileNameLength / sizeof(WCHAR), file_info->FileName); filenamew[size - 1] = L'\0';