From 7596c767e7d464fa853b69aead8cb47ad410b515 Mon Sep 17 00:00:00 2001 From: Aaron Lipinski Date: Thu, 7 May 2026 23:45:01 +0400 Subject: [PATCH] fix: avoid undefined behavior in random seed --- ui/mtr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } /* -- 2.47.3