diff options
author | Michael Mann <mmann78@netscape.net> | 2013-11-06 21:59:03 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-11-06 21:59:03 +0000 |
commit | c59fab03526852f21665de59f447bde19e0d1f0e (patch) | |
tree | f3a6fda2c855483088d02f6bedfe1387374cb109 /epan/reassemble.c | |
parent | c011e545674dd00b96ad3a64cd807d0871e8f7d7 (diff) |
Correctly report segments marked with REASSEMBLE_FLAGS_NO_FRAG_NUMBER. Bug 9304 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9304)
Instead of incrementing the offset for each new segment by one we add the length of the segment so that each segment is correctly shown in the segment list.
It proves to be very useful to find which packet (segment) is causing an application dissector to go wrong.
From Matthieu Patou
svn path=/trunk/; revision=53118
Diffstat (limited to 'epan/reassemble.c')
-rw-r--r-- | epan/reassemble.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/epan/reassemble.c b/epan/reassemble.c index 5b5426b4c1..87319c1db1 100644 --- a/epan/reassemble.c +++ b/epan/reassemble.c @@ -1630,7 +1630,7 @@ fragment_add_seq_work(fragment_head *fd_head, tvbuff_t *tvb, const int offset, * sequence number of that fragment (which is NOT * the length of the packet!) */ - fd_head->datalen = fd->offset; + fd_head->datalen = fd->offset + fd->len; fd_head->flags |= FD_DATALEN_SET; } } @@ -1753,18 +1753,18 @@ fragment_add_seq_work(fragment_head *fd_head, tvbuff_t *tvb, const int offset, max = 0; for(fd_i=fd_head->next;fd_i;fd_i=fd_i->next) { if ( fd_i->offset==max ){ - max++; + max += fd_i->len; } } /* max will now be datalen+1 if all fragments have been seen */ - if (max <= fd_head->datalen) { + if (max < fd_head->datalen) { /* we have not received all packets yet */ return FALSE; } - if (max > (fd_head->datalen+1)) { + if (max > fd_head->datalen) { /* oops, too long fragment detected */ fd->flags |= FD_TOOLONGFRAGMENT; fd_head->flags |= FD_TOOLONGFRAGMENT; @@ -1866,7 +1866,7 @@ fragment_add_seq_common(reassembly_table *table, tvbuff_t *tvb, */ for (fd = fd_head; fd != NULL; fd = fd->next) { if (fd->next == NULL) - frag_number = fd->offset + 1; + frag_number = fd->offset + fd->len; } } } |