aboutsummaryrefslogtreecommitdiff
path: root/dhcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'dhcp.c')
-rw-r--r--dhcp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/dhcp.c b/dhcp.c
index 5bb16b9..f1cdc36 100644
--- a/dhcp.c
+++ b/dhcp.c
@@ -1257,12 +1257,13 @@ dhcp_getoption(struct dhcpcd_ctx *ctx,
*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;