diff --git a/adsbus/airspy_adsb.c b/adsbus/airspy_adsb.c index 45bb75d..03c2952 100644 --- a/adsbus/airspy_adsb.c +++ b/adsbus/airspy_adsb.c @@ -50,6 +50,9 @@ static bool airspy_adsb_parse_common(const struct airspy_adsb_common_overlay *ov return false; } uint16_t mlat_mhz = 2 * (uint16_t) hex_to_int(overlay->mlat_precision, sizeof(overlay->mlat_precision) / 2); + if (!mlat_mhz) { + return false; + } packet->mlat_timestamp = packet_mlat_timestamp_scale_in(hex_to_int(overlay->mlat_timestamp, sizeof(overlay->mlat_timestamp) / 2), UINT32_MAX, mlat_mhz, &state->mlat_state); packet->rssi = packet_rssi_scale_in((uint32_t) hex_to_int(overlay->rssi, sizeof(overlay->rssi) / 2), UINT16_MAX); return true; diff --git a/adsbus/proto.c b/adsbus/proto.c index 3641929..4026148 100644 --- a/adsbus/proto.c +++ b/adsbus/proto.c @@ -75,7 +75,10 @@ static bool proto_parse_header(AdsbHeader *header, struct packet *packet, struct return false; } - if (header->mlat_timestamp_mhz > UINT16_MAX) { + if (!header->mlat_timestamp_mhz || + header->mlat_timestamp_mhz > UINT16_MAX || + !header->mlat_timestamp_max || + !header->rssi_max) { return false; } state->mlat_timestamp_mhz = (uint16_t) header->mlat_timestamp_mhz;