]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
DHCP: Avoid mis-aligned BOOTP structure
authorRoy Marples <roy@marples.name>
Mon, 20 Apr 2020 21:18:41 +0000 (22:18 +0100)
committerRoy Marples <roy@marples.name>
Mon, 20 Apr 2020 21:18:41 +0000 (22:18 +0100)
This was caused by the recent change to pass back the frame header.

src/dhcp.c

index 879ce3e5dd4a74e3a770284f2b6329fe6e50ddf5..3fd72f851e80d62f0de0cef3d2dbeb34319a62a5 100644 (file)
@@ -3494,8 +3494,9 @@ dhcp_packet(struct interface *ifp, uint8_t *data, size_t len)
                            __func__, ifp->name);
                        return;
                }
-               data += fl;
                len -= fl;
+               /* Move the data to avoid alignment errors. */
+               memmove(data, data + fl, len);
        }
 
        /* Validate filter. */