From 46cae1bfc2ee435fed7c73a15d0b6979fe6d43a3 Mon Sep 17 00:00:00 2001 From: "Ilya A. Evenbach" Date: Mon, 22 Apr 2024 05:39:24 -0700 Subject: [PATCH] socket: fix ubsan complaint about incorrect left-shift in generate_local_port() n needs to be uint32_t to fit left shift by 22 bits https://github.com/thom311/libnl/pull/379 Conflict:NA Reference:https:/github.com/thom311/libnl/commit/46cae1bfc2ee435fed7c73a15d0b6979fe6d43a3 --- lib/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/socket.c b/lib/socket.c index 2ca14f6..21a53bd 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -78,7 +78,7 @@ static NL_RW_LOCK(port_map_lock); static uint32_t generate_local_port(void) { int i, j, m; - uint16_t n; + uint32_t n; static uint16_t idx_state = 0; uint32_t pid = getpid() & 0x3FFFFF; -- 2.33.0