Fix pcap trace capture crash for packets > 512 bytes

Change-Id: I9397ac756290953a14e3adfe5b7c980ecf92bac2
Signed-off-by: John Lo <loj@cisco.com>
diff --git a/vnet/vnet/unix/pcap.h b/vnet/vnet/unix/pcap.h
index e7bb218..563eafc 100644
--- a/vnet/vnet/unix/pcap.h
+++ b/vnet/vnet/unix/pcap.h
@@ -169,7 +169,8 @@
   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;