aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2016-04-27 09:56:36 -0400
committerJohn Lo <loj@cisco.com>2016-04-27 09:56:36 -0400
commit644ec43b5e82cf682698c0efb5d5bb24cbe75849 (patch)
tree0ddbf8bf92caf6f4cd4f3c9d8457dbbf9e6bb2b9
parent7afda3aee55bb25a274c3d1da48589a82d8c6d3b (diff)
Fix pcap trace capture crash for packets > 512 bytes
Change-Id: I9397ac756290953a14e3adfe5b7c980ecf92bac2 Signed-off-by: John Lo <loj@cisco.com>
-rw-r--r--vnet/vnet/unix/pcap.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/vnet/vnet/unix/pcap.h b/vnet/vnet/unix/pcap.h
index e7bb218d506..563eafc102b 100644
--- a/vnet/vnet/unix/pcap.h
+++ b/vnet/vnet/unix/pcap.h
@@ -169,7 +169,8 @@ pcap_add_buffer (pcap_main_t * pm,
d = pcap_add_packet (pm, time_now, n_bytes_in_trace, n_left);
while (1)
{
- clib_memcpy (d, b->data + b->current_data, b->current_length);
+ u32 copy_length = clib_min ((u32) n_left, b->current_length);
+ clib_memcpy (d, b->data + b->current_data, copy_length);
n_left -= b->current_length;
if (n_left <= 0)
break;