stanag4607: add check for wtap max size.
Bug: 11472 Change-Id: Ic269046e697ac5e65301caf4ea5586098d030458 Reviewed-on: https://code.wireshark.org/review/10279 Reviewed-by: Evan Huus <eapache@gmail.com> Petri-Dish: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
6c065783c5
commit
e0a87d8cd1
|
@ -73,6 +73,16 @@ static gboolean stanag4607_read_file(wtap *wth, FILE_T fh, struct wtap_pkthdr *p
|
|||
|
||||
/* The next 4 bytes are the packet length */
|
||||
packet_size = pntoh32(&stanag_pkt_hdr[2]);
|
||||
if (packet_size > WTAP_MAX_PACKET_SIZE) {
|
||||
/*
|
||||
* Probably a corrupt capture file; don't blow up trying
|
||||
* to allocate space for an immensely-large packet.
|
||||
*/
|
||||
*err = WTAP_ERR_BAD_FILE;
|
||||
*err_info = g_strdup_printf("stanag4607: File has %" G_GUINT32_FORMAT "d-byte packet, "
|
||||
"bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE);
|
||||
return FALSE;
|
||||
}
|
||||
phdr->caplen = packet_size;
|
||||
phdr->len = packet_size;
|
||||
|
||||
|
|
Loading…
Reference in New Issue