summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2018-05-08 12:39:26 +0100
committerRoy Marples <roy@marples.name>2018-05-08 12:39:26 +0100
commit6b82f328bc50fcb1e652cb6662fa5423026b15d2 (patch)
treedc8aed6762e07b87717aeb4086e25819d8a189ad
parent7e717094d3ad5b9d84941010134e9c7179b253f8 (diff)
downloaddhcpcd-6b82f328bc50fcb1e652cb6662fa5423026b15d2.tar.xz
dhcp6: fix a memory issue with prior patch
Don't allocate memory for T1 or T2 timers when requesting IA_TA addresses.
-rw-r--r--src/dhcp6.c8
1 files changed, 7 insertions, 1 deletions
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: