From: Willy Tarreau Date: Tue, 25 Feb 2020 08:41:22 +0000 (+0100) Subject: CLEANUP: stick-tables: use read_u32() to display a node's key X-Git-Tag: v2.2-dev3~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6cde5d883c03955efd65acfb5b718bd8a63e4c89;p=thirdparty%2Fhaproxy.git CLEANUP: stick-tables: use read_u32() to display a node's key This fixes another aliasing issue that pops up in stick_table.c and peers.c's debug code. --- diff --git a/src/peers.c b/src/peers.c index 659992cffc..f5a4f18655 100644 --- a/src/peers.c +++ b/src/peers.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -475,7 +476,7 @@ static int peer_prepare_updatemsg(char *msg, size_t size, struct peer_prep_param cursor += stlen; } else if (st->table->type == SMP_T_SINT) { - netinteger = htonl(*((uint32_t *)ts->key.key)); + netinteger = htonl(read_u32(ts->key.key)); memcpy(cursor, &netinteger, sizeof(netinteger)); cursor += sizeof(netinteger); } diff --git a/src/stick_table.c b/src/stick_table.c index 9937f115f0..665cc37680 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -3366,7 +3367,7 @@ static int table_dump_entry_to_buffer(struct buffer *msg, chunk_appendf(msg, " key=%s", addr); } else if (t->type == SMP_T_SINT) { - chunk_appendf(msg, " key=%u", *(unsigned int *)entry->key.key); + chunk_appendf(msg, " key=%u", read_u32(entry->key.key)); } else if (t->type == SMP_T_STR) { chunk_appendf(msg, " key=");