From: Aaron Lipinski Date: Thu, 7 May 2026 19:45:01 +0000 (+0400) Subject: fix: avoid undefined behavior in random seed X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=refs%2Fpull%2F574%2Fhead;p=thirdparty%2Fmtr.git fix: avoid undefined behavior in random seed --- diff --git a/ui/mtr.c b/ui/mtr.c index 6886bce..3814621 100644 --- a/ui/mtr.c +++ b/ui/mtr.c @@ -712,7 +712,7 @@ static void init_rand( struct timeval tv; gettimeofday(&tv, NULL); - srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec); + srand(((getpid() & 0xffff) << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec); } /*