From: Roy Marples Date: Tue, 8 May 2018 11:39:26 +0000 (+0100) Subject: dhcp6: fix a memory issue with prior patch X-Git-Tag: v7.0.5~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b82f328bc50fcb1e652cb6662fa5423026b15d2;p=thirdparty%2Fdhcpcd.git dhcp6: fix a memory issue with prior patch Don't allocate memory for T1 or T2 timers when requesting IA_TA addresses. --- diff --git a/src/dhcp6.c b/src/dhcp6.c index a557632e..6eb3f448 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -778,7 +778,13 @@ dhcp6_makemessage(struct interface *ifp) } /* FALLTHROUGH */ case DH6S_INIT: - len += ifo->ia_len * (sizeof(o) + (sizeof(uint32_t) * 3)); + for (l = 0; l < ifo->ia_len; l++) { + ifia = &ifo->ia[l]; + len += sizeof(o) + sizeof(uint32_t); /* IAID */ + /* IA_TA does not have T1 or T2 timers */ + if (ifo->ia[l].ia_type != D6_OPTION_IA_TA) + len += sizeof(uint32_t) + sizeof(uint32_t); + } IA = 1; break; default: