From 4a37e6b8a3a68e38ef8f308331ac34a7c9f539de Mon Sep 17 00:00:00 2001 From: marcsello Date: Tue, 3 Nov 2020 20:54:43 +0100 Subject: [PATCH] Fixed Magic checked in reverse order --- src/ciff_tools.c | 2 +- src/ciff_tools.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ciff_tools.c b/src/ciff_tools.c index a8cefb7..5180c05 100644 --- a/src/ciff_tools.c +++ b/src/ciff_tools.c @@ -32,7 +32,7 @@ uint8_t parse_ciff_from_mem(const uint8_t* data, uint64_t data_len, uint64_t* wi // Do some preflight checks // Check if the magic is valid... - if (header_info->magic != 0x43494646) { + if (header_info->magic != 0x46464943) { return CIFF_PARSE_HEADER_BAD_MAGIC; } diff --git a/src/ciff_tools.h b/src/ciff_tools.h index d00e109..fa27b5e 100644 --- a/src/ciff_tools.h +++ b/src/ciff_tools.h @@ -6,7 +6,6 @@ #define CAFF_PREVIEWER_CIFF_TOOLS_H #include -#include "magic_memory.h" #define CIFF_PARSE_UNKNOWN_ERROR 1 #define CIFF_PARSE_HEADER_LENGTHS_INCORRECT 2 @@ -16,7 +15,7 @@ #define CIFF_PARSE_SUCCESS 0 typedef struct __attribute__ ((packed)) ciff_static_header_t { - uint32_t magic; // should be equal to 0x43494646 + uint32_t magic; // should be equal to 0x46464943 (Because x86 is big-endian, so essentially this is in reverse) uint64_t header_size; uint64_t content_size; uint64_t width;