aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>2021-06-17 18:01:32 +0900
committerAkihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>2021-06-18 16:39:56 +0900
commitc9f314f6e315a5518432761fea864196a290f799 (patch)
treebef584a56bd96808619fc3cb425e11c3da307a64
parent6ef66db79938d763212320c1b64bc562c23d25a8 (diff)
downloadslirp-c9f314f6e315a5518432761fea864196a290f799.zip
slirp-c9f314f6e315a5518432761fea864196a290f799.tar.gz
slirp-c9f314f6e315a5518432761fea864196a290f799.tar.bz2
Fix "DHCP broken in libslirp v4.6.0"
Fix issue 48 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
-rw-r--r--src/bootp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bootp.c b/src/bootp.c
index cafa1eb..0a35873 100644
--- a/src/bootp.c
+++ b/src/bootp.c
@@ -359,7 +359,9 @@ static void bootp_reply(Slirp *slirp,
daddr.sin_addr.s_addr = 0xffffffffu;
- m->m_len = sizeof(struct bootp_t) - sizeof(struct ip) - sizeof(struct udphdr);
+ assert ((q - rbp->bp_vend + 1) <= DHCP_OPT_LEN);
+
+ m->m_len = sizeof(struct bootp_t) + (q - rbp->bp_vend + 1) - sizeof(struct ip) - sizeof(struct udphdr);
udp_output(NULL, m, &saddr, &daddr, IPTOS_LOWDELAY);
}