journal: fix byte-order conversion in journal_file_append_data()
head_data_offset is declared as le64_t in journal-def.h, so it must be assigned with htole64(p), not le64toh(p). All other le64_t field assignments in this file (hash, next_hash_offset) consistently use htole64(). On little-endian systems this makes no difference, but on big-endian systems the field->data link would be stored with incorrect byte order, corrupting journal file traversal. Assisted-by: claude-opus-4-8 <noreply@anthropic.com>
This commit is contained in:
committed by
Yu Watanabe
parent
c925e405f3
commit
98852876dd
@@ -1915,7 +1915,7 @@ static int journal_file_append_data(
|
||||
|
||||
/* ... and link it in. */
|
||||
o->data.next_field_offset = fo->field.head_data_offset;
|
||||
fo->field.head_data_offset = le64toh(p);
|
||||
fo->field.head_data_offset = htole64(p);
|
||||
|
||||
if (ret_object)
|
||||
*ret_object = o;
|
||||
|
||||
Reference in New Issue
Block a user