aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/netxray.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-01-22 00:26:36 +0000
committerGuy Harris <guy@alum.mit.edu>2014-01-22 00:26:36 +0000
commit90d7c5f59b574e254bc1bb70aaaf12372fe97cc3 (patch)
tree7bc8e69b7cc459b8dfef190d1b33a7cb092a7bf3 /wiretap/netxray.c
parent5c825d6a364d83dace7b6c682aa47678e89df79b (diff)
Don't write out packets that have a "captured length" bigger than we're
willing to read or that's bigger than will fit in the file format; instead, report an error. For the "I can't write a packet of that type in that file type" error, report the file type in question. svn path=/trunk/; revision=54882
Diffstat (limited to 'wiretap/netxray.c')
-rw-r--r--wiretap/netxray.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index 189c70a04c..774262cf3e 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -1742,6 +1742,13 @@ netxray_dump_1_1(wtap_dumper *wdh,
guint32 t32;
struct netxrayrec_1_x_hdr rec_hdr;
+ /* The captured length field is 16 bits, so there's a hard
+ limit of 65535. */
+ if (phdr->caplen > 65535) {
+ *err = WTAP_ERR_PACKET_TOO_LARGE;
+ return FALSE;
+ }
+
/* NetXRay/Windows Sniffer files have a capture start date/time
in the header, in a UNIX-style format, with one-second resolution,
and a start time stamp with microsecond resolution that's just
@@ -1908,6 +1915,12 @@ netxray_dump_2_0(wtap_dumper *wdh,
guint32 t32;
struct netxrayrec_2_x_hdr rec_hdr;
+ /* Don't write anything we're not willing to read. */
+ if (phdr->caplen > WTAP_MAX_PACKET_SIZE) {
+ *err = WTAP_ERR_PACKET_TOO_LARGE;
+ return FALSE;
+ }
+
/* NetXRay/Windows Sniffer files have a capture start date/time
in the header, in a UNIX-style format, with one-second resolution,
and a start time stamp with microsecond resolution that's just