summaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'vnet')
-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;