aboutsummaryrefslogtreecommitdiffstats
path: root/reassemble.c
diff options
context:
space:
mode:
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2003-04-17 10:31:35 +0000
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2003-04-17 10:31:35 +0000
commit877cdb93925670aeb6473fb7d10470171a4db7c6 (patch)
tree732bea378b1a700426a491ed6c5fdae24ddf8664 /reassemble.c
parentf764c42c63009d5a9e34ee3c928a34ad07b4cd04 (diff)
Add a small extra check in fragment_add() to make it idempotent.
This solves a problem introduced by the recent rewrite of dcerpc-over-smb reassembly which caused the last fragment for each dcerpc pdu to be duplicated and flagged as overlapping fragment. This git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@7478 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'reassemble.c')
-rw-r--r--reassemble.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/reassemble.c b/reassemble.c
index b89b5bff72..e29fd32ccb 100644
--- a/reassemble.c
+++ b/reassemble.c
@@ -1,7 +1,7 @@
/* reassemble.c
* Routines for {fragment,segment} reassembly
*
- * $Id: reassemble.c,v 1.30 2003/04/09 09:04:08 sahlberg Exp $
+ * $Id: reassemble.c,v 1.31 2003/04/17 10:31:35 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -429,10 +429,12 @@ fragment_add(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id,
{
fragment_key key, *new_key;
fragment_data *fd_head;
+ fragment_data *fd_item;
fragment_data *fd;
fragment_data *fd_i;
guint32 max, dfpos;
unsigned char *old_data;
+ gboolean already_added=FALSE;
/* create key to search hash with */
key.src = pinfo->src;
@@ -441,8 +443,20 @@ fragment_add(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id,
fd_head = g_hash_table_lookup(fragment_table, &key);
+ /* Just check if we have seen this fragment before, i.e.
+ if we have already added it to reassembly.
+ We can not trust the flags.visited field since we sometimes
+ might call a subdissector multiple times.
+ As an additional check just make sure we have not already added
+ this frame to the reassembly list
+ */
+ for(fd_item=fd_head;fd_item;fd_item=fd_item->next){
+ if(pinfo->fd->num==fd_item->frame){
+ already_added=TRUE;
+ }
+ }
/* have we already seen this frame ?*/
- if (pinfo->fd->flags.visited) {
+ if (pinfo->fd->flags.visited || already_added) {
if (fd_head != NULL && fd_head->flags & FD_DEFRAGMENTED) {
return fd_head;
} else {