summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-06-01 05:44:22 +0000
committerRoy Marples <roy@marples.name>2016-06-01 05:44:22 +0000
commit77f0b46ed38e2dca5f663de2e3cb230d33ebaffb (patch)
tree335ae12fc60def00fbc0c56b700345bd88d1dece
parenta2af95d72dea4ee7d5369c210247efae98aca05f (diff)
downloaddhcpcd-77f0b46ed38e2dca5f663de2e3cb230d33ebaffb.tar.xz
We can work with saved leases without a full vendor area.
-rw-r--r--dhcp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/dhcp.c b/dhcp.c
index 3c25dc0f..f0057fb9 100644
--- a/dhcp.c
+++ b/dhcp.c
@@ -1165,7 +1165,12 @@ read_lease(struct interface *ifp, struct bootp **bootp)
return 0;
}
- if (bytes < sizeof(**bootp)) {
+ /* Ensure the packet is at lease BOOTP sized
+ * with a vendor area of 4 octets
+ * (it should be more, and our read packet enforces this so this
+ * code should not be needed, but of course people could
+ * scribble whatever in the stored lease file. */
+ if (bytes < offsetof(struct bootp, vend) + 4) {
free(lease);
logger(ifp->ctx, LOG_ERR, "%s: truncated lease", __func__);
return 0;