[Mono-dev] [PATCH] MS.NET compatible Path.GetTempFileName

Ben Maurer bmaurer at ximian.com
Fri Jan 6 14:44:18 EST 2006

> MS.NET uses Windows API GetTempFileName function for
> Path.GetTempFileName. If we want full compatibility we should implement
> it in the I/O layer using a global unsigned 16-bit counter that starts
> from zero and is incremented without overflow check each time
> GetTempFileName is called.

I have no idea how on earth an application could depend on this specific
pattern (without being completely pendantic and checking for .tmp). Did
this issue happen with some real life app?

> Altough a managed implementation can be as good as a native one I think
> the file name pattern should be the same. The attached patch modifies
> the pattern to "tmp<UUUU>.tmp" that is the same used by MS.NET. (There
> is no zero padding in <UUUU>.)

What does msft do if you create all 64k files tmp0000.tmp to tmpffff.tmp?
That sounds like a trivial DoS.

-- Ben

More information about the Mono-devel-list mailing list