summaryrefslogtreecommitdiff
path: root/wiretap/nettl.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/nettl.c
parent5c825d6a364d83dace7b6c682aa47678e89df79b (diff)
downloadwireshark-90d7c5f59b574e254bc1bb70aaaf12372fe97cc3.tar.gz
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/nettl.c')
-rw-r--r--wiretap/nettl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/wiretap/nettl.c b/wiretap/nettl.c
index e869fb711f..ac3f7ed499 100644
--- a/wiretap/nettl.c
+++ b/wiretap/nettl.c
@@ -734,6 +734,12 @@ static gboolean nettl_dump(wtap_dumper *wdh,
struct nettlrec_hdr rec_hdr;
guint8 dummyc[24];
+ /* 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;
+ }
+
memset(&rec_hdr,0,sizeof(rec_hdr));
/* HP-UX 11.X header should be 68 bytes */
rec_hdr.hdr_len = g_htons(sizeof(rec_hdr) + 4);