summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya A. Evenbach <ievenbach@aurora.tech>2024-04-22 05:39:24 -0700
committerThomas Haller <thaller@redhat.com>2024-04-26 08:54:39 +0200
commit46cae1bfc2ee435fed7c73a15d0b6979fe6d43a3 (patch)
tree39f8de5afd0e6f13787c999e61983b543126ef28
parent96ddcd999297d8697235e75417bda8a66e26bb0f (diff)
downloadlibnl-46cae1bfc2ee435fed7c73a15d0b6979fe6d43a3.tar.gz
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
-rw-r--r--lib/socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/socket.c b/lib/socket.c
index 9b42f679..742cdace 100644
--- a/lib/socket.c
+++ b/lib/socket.c
@@ -84,7 +84,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;