commit 46d56493968a98779f5ca3a1e63e498bace3678b parent 2caeb2c96c40984faa37f2264b1d1b070f4e61f8 Author: Christian Grothoff <grothoff@gnunet.org> Date: Sun, 16 Aug 2026 08:30:47 +0200 avoid unaligned access Diffstat:
| M | src/pq/pq_query_helper.c | | | 7 | ++++++- |
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c @@ -817,8 +817,13 @@ qconv_array ( for (size_t i = 0; i < num; i++) { size_t sz = same_sized ? meta->same_size : sizes[i]; + uint32_t bsz = htonl ((uint32_t) sz); - *(uint32_t *) out = htonl (sz); + /* Note: @a out is not necessarily aligned, as elements + may have odd sizes; so we must not type-pun here. */ + GNUNET_memcpy (out, + &bsz, + sizeof (bsz)); out += sizeof(uint32_t); switch (meta->typ) {