Fix Path.GetTempFileName on Windows (#17148)
authorStephen Toub <stoub@microsoft.com>
Fri, 23 Mar 2018 16:41:21 +0000 (12:41 -0400)
committerGitHub <noreply@github.com>
Fri, 23 Mar 2018 16:41:21 +0000 (12:41 -0400)
commit9ac41819ab05282798c498b373a5017b1c2c4e64
tree6701c90a7b70bae6d95d868b86d994986dfd0c38
parent1ee83de5d83eec5362b4e335a326bfe816afa3a1
Fix Path.GetTempFileName on Windows (#17148)

GetTempFileNameW doesn't return the required length of the buffer; it returns the unique number used in the temporary file name.  But the calling code is using that result as a length, resulting in sometimes truncated paths, and sometimes paths that aren't at all related to the original due to state left over in a pooled buffer.
src/mscorlib/shared/System/IO/Path.Windows.cs
src/mscorlib/shared/System/Text/ValueStringBuilder.cs