Skip to content

Commit

Permalink
MINOR: stktable: fix potential build issue in smp_to_stkey
Browse files Browse the repository at this point in the history
smp_to_stkey() uses an ambiguous cast from 64bit integer to 32 bit
unsigned integer. While it is intended, let's make the cast less
ambiguous by explicitly casting the right part of the assignment to the
proper type.

This should fix GH haproxy#2838
  • Loading branch information
Darlelet committed Jan 13, 2025
1 parent 4a5d82a commit f399dbf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/stick_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,7 @@ struct stktable_key *smp_to_stkey(struct sample *smp, struct stktable *t)
/* The stick table require a 32bit unsigned int, "sint" is a
* signed 64 it, so we can convert it inplace.
*/
*_sint = smp->data.u.sint;
*_sint = (uint)smp->data.u.sint;
static_table_key.key = _sint;
static_table_key.key_len = 4;
break;
Expand Down

0 comments on commit f399dbf

Please sign in to comment.