Thanks to Nico Golde for the report.
Fixes CVE-2016-1504
*os = 2; /* code + len */
*code = (unsigned int)*od++;
*len = (size_t)*od++;
- if (*len > ol) {
+ if (*len > ol - *os) {
errno = EINVAL;
return NULL;
}
}
+ *oopt = NULL;
for (i = 0, opt = ctx->dhcp_opts; i < ctx->dhcp_opts_len; i++, opt++) {
if (opt->option == *code) {
*oopt = opt;
}
o = (const struct dhcp6_option *)od;
*len = ntohs(o->len);
- if (*len > ol) {
+ if (*len > ol - *os) {
errno = EINVAL;
return NULL;
}
} else
o = NULL;
+ *oopt = NULL;
for (i = 0, opt = ctx->dhcp6_opts;
i < ctx->dhcp6_opts_len; i++, opt++)
{