diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2003-04-17 10:31:35 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2003-04-17 10:31:35 +0000 |
commit | 379298f77fcf13f68f505df662becd7005cdf9f2 (patch) | |
tree | 732bea378b1a700426a491ed6c5fdae24ddf8664 /reassemble.c | |
parent | 4eae58408c1d5c01bfbf6d075edb78f6243618ac (diff) | |
download | wireshark-379298f77fcf13f68f505df662becd7005cdf9f2.tar.gz wireshark-379298f77fcf13f68f505df662becd7005cdf9f2.tar.bz2 wireshark-379298f77fcf13f68f505df662becd7005cdf9f2.zip |
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
svn path=/trunk/; revision=7478
Diffstat (limited to 'reassemble.c')
-rw-r--r-- | reassemble.c | 18 |
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 { |