From: dongshengyuan <545258830@qq.com> Date: Thu, 25 Jun 2026 08:01:42 +0000 (+0800) Subject: sd-journal: fix memzero size in data hash table setup X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9e8f8959217486bb50a604c91982922f55cfac6;p=thirdparty%2Fsystemd.git sd-journal: fix memzero size in data hash table setup journal_file_setup_data_hash_table() allocates s * sizeof(HashItem) bytes for the hash table but then only zeroes s bytes, leaving 15/16 of the entries uninitialized. This corrupts the hash chain in any newly created journal file. The adjacent journal_file_setup_field_hash_table() already uses the correct size. Signed-off-by: dongshengyuan --- diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index bd8a4348bda..2207b47abfe 100644 --- a/src/libsystemd/sd-journal/journal-file.c +++ b/src/libsystemd/sd-journal/journal-file.c @@ -1301,7 +1301,7 @@ static int journal_file_setup_data_hash_table(JournalFile *f) { if (r < 0) return r; - memzero(o->hash_table.items, s); + memzero(o->hash_table.items, s * sizeof(HashItem)); f->header->data_hash_table_offset = htole64(p + offsetof(Object, hash_table.items)); f->header->data_hash_table_size = htole64(s * sizeof(HashItem));