aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/lanalyzer.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/lanalyzer.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/lanalyzer.c')
-rw-r--r--wiretap/lanalyzer.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c
index 97f9764411..494e2591de 100644
--- a/wiretap/lanalyzer.c
+++ b/wiretap/lanalyzer.c
@@ -658,7 +658,7 @@ static gboolean lanalyzer_dump(wtap_dumper *wdh,
double x;
int i;
int len;
- struct timeval tv;
+ struct timeval tv;
LA_TmpInfo *itmp = (LA_TmpInfo*)(wdh->priv);
struct timeval td;
@@ -672,6 +672,12 @@ static gboolean lanalyzer_dump(wtap_dumper *wdh,
len = phdr->caplen + (phdr->caplen ? LA_PacketRecordSize : 0);
+ /* len goes into a 16-bit field, so there's a hard limit of 65535. */
+ if (len > 65535) {
+ *err = WTAP_ERR_PACKET_TOO_LARGE;
+ return FALSE;
+ }
+
if (!s16write(wdh, GUINT16_TO_LE(0x1005), err))
return FALSE;
if (!s16write(wdh, GUINT16_TO_LE(len), err))