]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix payload address calculation.
authorRoy Marples <roy@marples.name>
Mon, 20 Jan 2014 16:16:54 +0000 (16:16 +0000)
committerRoy Marples <roy@marples.name>
Mon, 20 Jan 2014 16:16:54 +0000 (16:16 +0000)
Thanks to Sebastian Huber.

bpf.c

diff --git a/bpf.c b/bpf.c
index 67fd5056dfa4a43f94f4a68b44048a08c5748b43..59d17d92a973624a422504f512ceef8a73e410f3 100644 (file)
--- a/bpf.c
+++ b/bpf.c
@@ -197,7 +197,8 @@ ipv4_getrawpacket(struct interface *ifp, int protocol,
                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;