Skip to content

Commit

Permalink
From Jason Lango <jal@netapp.com>, a fix to a long-standing problem
Browse files Browse the repository at this point in the history
(which could cause core dumps in "Follow TCP Stream") -
"check_fragments()" was, when deleting a TCP segment at the beginning of
the list of segments, setting "src[index]" to point to the next segment,
not "frags[index]".  "src[index]" is the source IP address, not a
pointer to a fragment.

Also, make some routines not used outside "follow.c" static.

svn path=/trunk/; revision=341
  • Loading branch information
guyharris committed Jul 7, 1999
1 parent b547681 commit fba49cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 7 additions & 4 deletions follow.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* follow.c
*
* $Id: follow.c,v 1.8 1999/06/25 02:57:42 gram Exp $
* $Id: follow.c,v 1.9 1999/07/07 01:41:15 guy Exp $
*
* Copyright 1998 Mike Hall <mlh@io.com>
*
Expand Down Expand Up @@ -47,6 +47,9 @@ extern FILE* data_out_file;

gboolean incomplete_tcp_stream = FALSE;

static int check_fragments( int );
static void write_packet_data( const u_char *, int );

/* this will build libpcap filter text that will only
pass the packets related to the stream. There is a
chance that two streams could intersect, but not a
Expand Down Expand Up @@ -180,7 +183,7 @@ reassemble_tcp( u_long sequence, u_long length, const char* data, u_long data_le

/* here we search through all the frag we have collected to see if
one fits */
int
static int
check_fragments( int index ) {
tcp_frag *prev = NULL;
tcp_frag *current;
Expand All @@ -195,7 +198,7 @@ check_fragments( int index ) {
if( prev ) {
prev->next = current->next;
} else {
src[index] = GPOINTER_TO_UINT(current->next);
frags[index] = current->next;
}
free( current->data );
free( current );
Expand Down Expand Up @@ -227,7 +230,7 @@ reset_tcp_reassembly() {
}
}

void
static void
write_packet_data( const u_char* data, int length ) {
fwrite( data, 1, length, data_out_file );
}
Expand Down
4 changes: 1 addition & 3 deletions follow.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* follow.h
*
* $Id: follow.h,v 1.3 1999/03/23 20:25:50 deniel Exp $
* $Id: follow.h,v 1.4 1999/07/07 01:41:15 guy Exp $
*
* Copyright 1998 Mike Hall <mlh@io.com>
*
Expand Down Expand Up @@ -42,8 +42,6 @@ typedef struct _tcp_frag {

char* build_follow_filter( packet_info * );
void reassemble_tcp( u_long, u_long, const char*, u_long, int, u_long );
int check_fragments( int );
void reset_tcp_reassembly( void );
void write_packet_data( const u_char *, int );

#endif

0 comments on commit fba49cf

Please sign in to comment.