Skip to content

Commit

Permalink
Fix ubsan complaint about incorrect left-shift in generate_local_port()
Browse files Browse the repository at this point in the history
n needs to be uint32_t to fit left shift by 22 bits
  • Loading branch information
ievenbach committed Apr 24, 2024
1 parent 96ddcd9 commit 98a6f29
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 98a6f29

Please sign in to comment.