diff options
| author | Jessica Clarke <jrtc27@FreeBSD.org> | 2025-12-31 17:14:55 +0000 |
|---|---|---|
| committer | Jessica Clarke <jrtc27@FreeBSD.org> | 2025-12-31 17:14:55 +0000 |
| commit | 39047538cf5d8f26112f7b08b3c56967f70f7f94 (patch) | |
| tree | 3cac91dfeb3b4310d5595bac992e59eda53f8ef7 | |
| parent | e8567de718a4a16edbf5490e1c36360563e16667 (diff) | |
Merge commit faa5141b9be4 from file git (by Christos Zoulas):
PR/656: harry.sintonen: Fix bug in byte swapping that was caused by the change to make flags uint16_t and cont_level uint8_t.
This fixes using a magic.mgc built with a different endianness than
file(1) itself, e.g. when building powerpc64 on amd64.
PR: 292079
Fixes: ae316d1d1cff ("MFV: file 5.46.")
MFC after: 3 days
| -rw-r--r-- | contrib/file/src/apprentice.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/contrib/file/src/apprentice.c b/contrib/file/src/apprentice.c index 5289f8e87267..dde2dd1e0c2d 100644 --- a/contrib/file/src/apprentice.c +++ b/contrib/file/src/apprentice.c @@ -3646,15 +3646,14 @@ file_varint2uintmax_t(const unsigned char *us, int t, size_t *l) file_private void bs1(struct magic *m) { - m->cont_level = swap2(m->cont_level); + m->flag = swap2(m->flag); m->offset = swap4(CAST(uint32_t, m->offset)); m->in_offset = swap4(CAST(uint32_t, m->in_offset)); m->lineno = swap4(CAST(uint32_t, m->lineno)); if (IS_STRING(m->type)) { m->str_range = swap4(m->str_range); m->str_flags = swap4(m->str_flags); - } - else { + } else { m->value.q = swap8(m->value.q); m->num_mask = swap8(m->num_mask); } |
