summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv6-ia.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2013-12-03 22:00:33 +0100
committerSteven Barth <steven@midlink.org>2013-12-03 22:00:33 +0100
commit1565d76bd6ff2d1064c3d30e947dc70613417853 (patch)
treec0dca5b2447e09124a0b93cfa5e472f74f9b94ba /src/dhcpv6-ia.c
parentd02dc222e61e2464bf850a629030c8a8b9b57ee8 (diff)
Fix prefix class logic
Diffstat (limited to 'src/dhcpv6-ia.c')
-rw-r--r--src/dhcpv6-ia.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c
index 3d9fe83..b0a31a2 100644
--- a/src/dhcpv6-ia.c
+++ b/src/dhcpv6-ia.c
@@ -900,8 +900,10 @@ size_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface,
a->assigned = reqhint;
a->all_class = class_oro;
a->classes_cnt = classes_cnt;
- a->classes = malloc(classes_cnt * sizeof(uint16_t));
- memcpy(a->classes, classes, classes_cnt * sizeof(uint16_t));
+ if (classes_cnt) {
+ a->classes = malloc(classes_cnt * sizeof(uint16_t));
+ memcpy(a->classes, classes, classes_cnt * sizeof(uint16_t));
+ }
if (first)
memcpy(a->key, first->key, sizeof(a->key));