diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 385771e7bc3..f1af1b7abda 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -3683,6 +3683,7 @@ char * CDECL MSVCRT_tmpnam(char *s) { size = msvcrt_int_to_base32(tmpnam_unique++, tmpstr); memcpy(p, tmpstr, size); + p[size] = '\0'; if (GetFileAttributesA(s) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND) break; @@ -3714,6 +3715,7 @@ MSVCRT_wchar_t * CDECL MSVCRT_wtmpnam(MSVCRT_wchar_t *s) { size = msvcrt_int_to_base32_w(tmpnam_unique++, tmpstr); memcpy(p, tmpstr, size*sizeof(MSVCRT_wchar_t)); + p[size] = '\0'; if (GetFileAttributesW(s) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND) break; diff --git a/dlls/msvcrt/main.c b/dlls/msvcrt/main.c index 5d6e37a554d..45191cd8d8a 100644 --- a/dlls/msvcrt/main.c +++ b/dlls/msvcrt/main.c @@ -74,6 +74,8 @@ static inline void msvcrt_free_tls_mem(void) HeapFree(GetProcessHeap(),0,tls->strerror_buffer); HeapFree(GetProcessHeap(),0,tls->wcserror_buffer); HeapFree(GetProcessHeap(),0,tls->time_buffer); + HeapFree(GetProcessHeap(),0,tls->tmpnam_buffer); + HeapFree(GetProcessHeap(),0,tls->wtmpnam_buffer); if(tls->have_locale) { free_locinfo(tls->locinfo); free_mbcinfo(tls->mbcinfo);