diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-01-22 00:26:36 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-01-22 00:26:36 +0000 |
commit | 90d7c5f59b574e254bc1bb70aaaf12372fe97cc3 (patch) | |
tree | 7bc8e69b7cc459b8dfef190d1b33a7cb092a7bf3 /wiretap/commview.c | |
parent | 5c825d6a364d83dace7b6c682aa47678e89df79b (diff) | |
download | wireshark-90d7c5f59b574e254bc1bb70aaaf12372fe97cc3.tar.gz wireshark-90d7c5f59b574e254bc1bb70aaaf12372fe97cc3.tar.bz2 wireshark-90d7c5f59b574e254bc1bb70aaaf12372fe97cc3.zip |
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/commview.c')
-rw-r--r-- | wiretap/commview.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/wiretap/commview.c b/wiretap/commview.c index 4283a6f44b..0687a18b69 100644 --- a/wiretap/commview.c +++ b/wiretap/commview.c @@ -277,6 +277,14 @@ static gboolean commview_dump(wtap_dumper *wdh, commview_header_t cv_hdr; struct tm *tm; + /* Don't write out anything bigger than we can read. + * (The length field in packet headers is 16 bits, which + * imposes a hard limit.) */ + if (phdr->caplen > 65535) { + *err = WTAP_ERR_PACKET_TOO_LARGE; + return FALSE; + } + memset(&cv_hdr, 0, sizeof(cv_hdr)); cv_hdr.data_len = GUINT16_TO_LE((guint16)phdr->caplen); |