libuuid: fix UBSAN issue in get_random_fd()

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Theodore Ts'o 2018-02-23 15:39:46 -05:00
parent 847520f69e
commit 6074cf36b9

View File

@ -154,7 +154,7 @@ static int get_random_fd(void)
fcntl(fd, F_SETFD, i | FD_CLOEXEC);
}
#endif
srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
srand(((unsigned)getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
#ifdef DO_JRAND_MIX
jrand_seed[0] = getpid() ^ (tv.tv_sec & 0xFFFF);
jrand_seed[1] = getppid() ^ (tv.tv_usec & 0xFFFF);