git: 39047538cf5d - main - Merge commit faa5141b9be4 from file git (by Christos Zoulas):
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 31 Dec 2025 17:16:53 UTC
The branch main has been updated by jrtc27:
URL: https://cgit.FreeBSD.org/src/commit/?id=39047538cf5d8f26112f7b08b3c56967f70f7f94
commit 39047538cf5d8f26112f7b08b3c56967f70f7f94
Author: Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2025-12-31 17:14:55 +0000
Commit: Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2025-12-31 17:14:55 +0000
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
---
contrib/file/src/apprentice.c | 5 ++---
1 file 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);
}