Skip to content

Commit

Permalink
TCP reassembler: make sure additional packet array entries are NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
salcock committed Oct 14, 2024
1 parent 16232b6 commit d8ef7dd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/collector/reassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ int update_tcp_reassemble_stream(tcp_reassemble_stream_t *stream,

tcp_reass_segment_t *seg, *existing;
uint8_t *endptr;
int i;

HASH_FIND(hh, stream->segments, &seqno, sizeof(seqno), existing);
if (existing) {
Expand Down Expand Up @@ -560,6 +561,9 @@ int update_tcp_reassemble_stream(tcp_reassemble_stream_t *stream,
if (stream->pkt_cnt == stream->pkt_alloc) {
stream->packets = realloc(stream->packets,
(stream->pkt_alloc + 4) * sizeof(libtrace_packet_t *));
for (i = stream->pkt_alloc; i < stream->pkt_alloc + 4; i++) {
stream->packets[i] = NULL;
}
stream->pkt_alloc += 4;
}
stream->packets[stream->pkt_cnt] = pkt;
Expand Down

0 comments on commit d8ef7dd

Please sign in to comment.