changeset 2233:6229a6424748 draft

Fix payload address calculation. Thanks to Sebastian Huber.
author Roy Marples <roy@marples.name>
date Mon, 20 Jan 2014 16:16:54 +0000
parents 97f0168074a3
children 790e447ef39c
files bpf.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bpf.c	Mon Jan 20 15:19:11 2014 +0000
+++ b/bpf.c	Mon Jan 20 16:16:54 2014 +0000
@@ -197,7 +197,8 @@
 		if (state->buffer_pos + packet.bh_caplen + packet.bh_hdrlen >
 		    state->buffer_len)
 			goto next; /* Packet beyond buffer, drop. */
-		payload = state->buffer + packet.bh_hdrlen + ETHER_HDR_LEN;
+		payload = state->buffer + state->buffer_pos +
+		    packet.bh_hdrlen + ETHER_HDR_LEN;
 		bytes = packet.bh_caplen - ETHER_HDR_LEN;
 		if (bytes > len)
 			bytes = len;