summaryrefslogtreecommitdiff
path: root/libraries/base/cbits/Win32Utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/base/cbits/Win32Utils.c')
-rw-r--r--libraries/base/cbits/Win32Utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libraries/base/cbits/Win32Utils.c b/libraries/base/cbits/Win32Utils.c
index f3dec0d98d..69d30339ba 100644
--- a/libraries/base/cbits/Win32Utils.c
+++ b/libraries/base/cbits/Win32Utils.c
@@ -183,10 +183,9 @@ bool __createUUIDTempFileErrNo (wchar_t* pathName, wchar_t* prefix,
RPC_WSTR guidStr;
if (UuidToStringW ((UUID*)&guid, &guidStr) != S_OK)
goto fail;
-
/* We can't create a device path here since this path escapes the compiler
so instead return a normal path and have openFile deal with it. */
- wchar_t* devName = malloc (sizeof (wchar_t) * wcslen (pathName));
+ wchar_t* devName = malloc (sizeof (wchar_t) * (wcslen (pathName) + 1));
wcscpy (devName, pathName);
int len = wcslen (devName) + wcslen (suffix) + wcslen (prefix)
+ wcslen (guidStr) + 3;
@@ -204,6 +203,7 @@ bool __createUUIDTempFileErrNo (wchar_t* pathName, wchar_t* prefix,
free (devName);
RpcStringFreeW (&guidStr);
+
/* This should never happen because GUIDs are unique. But in case hell
froze over let's check anyway. */
DWORD dwAttrib = GetFileAttributesW (*tempFileName);