Even though the source to random.c has changed slightly
since I last checked, it seems that the last 12 bytes
of the 16 byte digest for srand are not being added to
the digest, as shown in function rnd (void *buffer) below:
MD5hash(digest, digest, sizeof(unsigned long));
The problem is using sizeof(unsigned long) (which on
32-bit machines tends to be 4 bytes and on 64-bit
machines tends to be 8 bytes), when in fact the digest
size is 16 bytes.
This problem is furthered by the fact that in the
function init_seed (char *seed), the digest is
allocated using sizeof(unsigned long) * 4, which can
differ on 64-bit machines, where the unsigned long is
not 32 bits:
if (!(digest = (unsigned long *) malloc(sizeof(unsigned
long) * 4))) {
In both these cases, none of this will cause a crash,
but it does cause a significant reduction in the
precision of the random seed.
- Kalzarius