diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-10-17 20:51:35 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-10-17 20:51:35 +0000 |
commit | 79e75da7deb18ded698c248a029451d03f706640 (patch) | |
tree | 7830bbad2a6d4d922b413d2e311d9194079481c3 /reassemble.c | |
parent | b2b3f9579a6bbbd7b686a9bd3bc68ab71d232a6a (diff) |
Put in a missing check for fragment overlaps, and add an assertion to
check for bogus dfpos values before using the value.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6447 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'reassemble.c')
-rw-r--r-- | reassemble.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/reassemble.c b/reassemble.c index ea75d8bc15..45e9cd1158 100644 --- a/reassemble.c +++ b/reassemble.c @@ -1,7 +1,7 @@ /* reassemble.c * Routines for {fragment,segment} reassembly * - * $Id: reassemble.c,v 1.23 2002/08/28 21:00:41 jmayer Exp $ + * $Id: reassemble.c,v 1.24 2002/10/17 20:51:35 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -723,8 +723,12 @@ fragment_add_seq_work(fragment_data *fd_head, tvbuff_t *tvb, int offset, } /* make sure it doesnt conflict with previous data */ dfpos=0; + last_fd=NULL; for (fd_i=fd_head->next;fd_i->offset!=fd->offset;fd_i=fd_i->next) { - dfpos += fd_i->len; + if (!last_fd || last_fd->offset!=fd_i->offset){ + dfpos += fd_i->len; + } + last_fd=fd_i; } if(fd_i->datalen!=fd->datalen){ fd->flags |= FD_OVERLAPCONFLICT; @@ -732,6 +736,7 @@ fragment_add_seq_work(fragment_data *fd_head, tvbuff_t *tvb, int offset, LINK_FRAG(fd_head,fd); return TRUE; } + g_assert(fd_head->len >= dfpos + fd->len); if ( memcmp(fd_head->data+dfpos, tvb_get_ptr(tvb,offset,fd->len),fd->len) ){ fd->flags |= FD_OVERLAPCONFLICT; |