]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stktable: fix potential build issue in smp_to_stkey
authorAurelien DARRAGON <adarragon@haproxy.com>
Fri, 10 Jan 2025 22:56:34 +0000 (23:56 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Mon, 13 Jan 2025 08:45:40 +0000 (09:45 +0100)
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 #2838

src/stick_table.c

index eebf3354dd173d3626ef0138a402cda51191bf47..122870059e0040dfb129811e692cc98d2e804f2e 100644 (file)
@@ -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;