On 07/20/2010 11:21 AM, Paul Eggert wrote:
> While looking at the random-number stuff I found a theoretical
> randomness bug in mktemp. The mktemp command currently uses 8 bytes
> of randomness to generate a file name, so with an invocation like
> this:
>
> $ mktemp foo.XXXXXXXXXXX
>
> the file name is not sufficiently random. There are 62 possibilities
> for each X, so one needs log2(62**11) random bits to generate a random
> 11-character value for the Xs, which is about 65.5 bits, but we are
> generating only 64 bits. The more Xs, the more randomness is needed,
> so the bug gets more "serious" as the number of Xs grows.
Meanwhile, glibc's mkstemp() only replaces the last 6 X, regardless of
how many additional X are present in the template. Do we even need the
extra randomness if the template contains more X?
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc Description: OpenPGP digital signature