From 5cb527d53ca88ac692beb55288172fc1003975fa Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 1 Jul 2021 09:15:15 +0200 Subject: [PATCH] Add support for the new Mares Genius firmware The new Mares Genius firmware v01.02.00 has a header which is 10 bytes larger. This difference is indicated with a change in the major version from 0 to 1. --- src/mares_iconhd_parser.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mares_iconhd_parser.c b/src/mares_iconhd_parser.c index 5d26d13..b518da6 100644 --- a/src/mares_iconhd_parser.c +++ b/src/mares_iconhd_parser.c @@ -374,7 +374,7 @@ mares_genius_cache (mares_iconhd_parser_t *parser) unsigned int type = array_uint16_le (data); unsigned int minor = data[2]; unsigned int major = data[3]; - if (type != 1 || major != 0 || minor > 1) { + if (type != 1 || major > 1 || minor > 1) { ERROR (abstract->context, "Unsupported object type (%u) or version (%u.%u).", type, major, minor); return DC_STATUS_DATAFORMAT; @@ -389,8 +389,14 @@ mares_genius_cache (mares_iconhd_parser_t *parser) extra = 8; } + // The Genius header (v1.x) has 10 bytes more at the end. + unsigned int more = 0; + if (major == 1) { + more = 16; + } + // Get the header size. - unsigned int headersize = 0xB8 + extra; + unsigned int headersize = 0xB8 + extra + more; if (headersize > size) { ERROR (abstract->context, "Buffer overflow detected!"); return DC_STATUS_DATAFORMAT;