diff --git a/src/hw_ostc3.c b/src/hw_ostc3.c index cfb25d7..7b87587 100644 --- a/src/hw_ostc3.c +++ b/src/hw_ostc3.c @@ -869,7 +869,7 @@ hw_ostc3_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, voi } else if (length == RB_LOGBOOK_SIZE_FULL + 2) { // A profile containing only the 2 byte end-of-profile // marker is considered a valid empty profile. - } else if (length < RB_LOGBOOK_SIZE_FULL + 5 + 2 || + } else if (length < RB_LOGBOOK_SIZE_FULL + 5 || array_uint24_le (profile + RB_LOGBOOK_SIZE_FULL) + delta != array_uint24_le (profile + HDR_FULL_LENGTH)) { // If there is more data available, then there should be a // valid profile header containing a length matching the diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c index 90994f8..d745ef8 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -20,6 +20,7 @@ */ #include +#include #include "libdivecomputer/units.h" @@ -679,8 +680,10 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call const hw_ostc_layout_t *layout = parser->layout; // Exit if no profile data available. - if (size == header || (size == header + 2 && - data[header] == 0xFD && data[header + 1] == 0xFD)) { + const unsigned char empty[] = {0x08, 0x00, 0x00, 0xFD, 0xFD}; + if (size == header || + (size == header + 2 && memcmp(data + header, empty + 3, 2) == 0) || + (size == header + 5 && memcmp(data + header, empty, 5) == 0)) { parser->cached = PROFILE; return DC_STATUS_SUCCESS; }