Fixes from american fuzzy lop testing.

This commit is contained in:
Ian Gulliver
2016-02-26 13:56:52 -08:00
parent 8d9a11076b
commit 9f5ad1518a
2 changed files with 7 additions and 1 deletions

View File

@@ -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;

View File

@@ -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;