From 53ea2da74d91292ee2b502f91feb80ca53ff931c Mon Sep 17 00:00:00 2001 From: Mike Nordell Date: Fri, 21 Jan 2005 02:34:33 +0000 Subject: [PATCH] Fix crashing browsing namespace with non-zero-terminated UNICODE_STRING. svn path=/trunk/; revision=13177 --- reactos/subsys/system/explorer/shell/ntobjfs.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/reactos/subsys/system/explorer/shell/ntobjfs.cpp b/reactos/subsys/system/explorer/shell/ntobjfs.cpp index 286a8f8963e..f7e86a0a691 100644 --- a/reactos/subsys/system/explorer/shell/ntobjfs.cpp +++ b/reactos/subsys/system/explorer/shell/ntobjfs.cpp @@ -227,6 +227,16 @@ void NtObjDirectory::read_directory(int scan_flags) memset(&w32fd, 0, sizeof(WIN32_FIND_DATA)); #ifdef UNICODE + if (info->name.string_ptr) { + info->name.string_ptr[info->name.string_len / sizeof(WCHAR)] = 0; + } else { + info->name.string_ptr = TEXT(""); + } + if (info->type.string_ptr) { + info->type.string_ptr[info->type.string_len / sizeof(WCHAR)] = 0; + } else { + info->type.string_ptr = TEXT(""); + } wcscpyn(p, info->name.string_ptr, _MAX_PATH); #else WideCharToMultiByte(CP_ACP, 0, info->name.string_ptr, info->name.string_len, p, MAX_PATH, 0, 0);