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/k12.c | |
parent | 5c825d6a364d83dace7b6c682aa47678e89df79b (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/k12.c')
-rw-r--r-- | wiretap/k12.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/wiretap/k12.c b/wiretap/k12.c index 10687f8412..8dfaef6e0c 100644 --- a/wiretap/k12.c +++ b/wiretap/k12.c @@ -1190,7 +1190,7 @@ static gboolean k12_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, /* encountered in k12_dump_src_setting). */ g_hash_table_foreach(file_data->src_by_id,k12_dump_src_setting,wdh); } - obj.record.len = 0x20 + phdr->len; + obj.record.len = 0x20 + phdr->caplen; obj.record.len += (obj.record.len % 4) ? 4 - obj.record.len % 4 : 0; len = obj.record.len; @@ -1198,12 +1198,12 @@ static gboolean k12_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, obj.record.len = g_htonl(obj.record.len); obj.record.type = g_htonl(K12_REC_PACKET); - obj.record.frame_len = g_htonl(phdr->len); + obj.record.frame_len = g_htonl(phdr->caplen); obj.record.input = g_htonl(pseudo_header->k12.input); obj.record.ts = GUINT64_TO_BE((((guint64)phdr->ts.secs - 631152000) * 2000000) + (phdr->ts.nsecs / 1000 * 2)); - memcpy(obj.record.frame,pd,phdr->len); + memcpy(obj.record.frame,pd,phdr->caplen); return k12_dump_record(wdh,len,obj.buffer, err); } |