uint32_t d;
p = get_option(ctx, bootp, bootp_len, option, &len);
- if (!p || len < (ssize_t)sizeof(d))
+ if (!p || len != (ssize_t)sizeof(d))
return -1;
memcpy(&d, p, sizeof(d));
if (i)
uint16_t d;
p = get_option(ctx, bootp, bootp_len, option, &len);
- if (!p || len < (ssize_t)sizeof(d))
+ if (!p || len != (ssize_t)sizeof(d))
return -1;
memcpy(&d, p, sizeof(d));
if (i)
size_t len;
p = get_option(ctx, bootp, bootp_len, option, &len);
- if (!p || len < (ssize_t)sizeof(*p))
+ if (!p || len != (ssize_t)sizeof(*p))
return -1;
if (i)
*i = *(p);
/* Ensure that no reject options are present */
for (i = 1; i < 255; i++) {
if (has_option_mask(ifo->rejectmask, i) &&
- get_option_uint8(ifp->ctx, &tmp,
- bootp, bootp_len, (uint8_t)i) == 0)
+ get_option(ifp->ctx, bootp, bootp_len, (uint8_t)i, NULL))
{
LOGDHCP(LOG_WARNING, "reject DHCP");
return;
/* Ensure that all required options are present */
for (i = 1; i < 255; i++) {
if (has_option_mask(ifo->requiremask, i) &&
- get_option_uint8(ifp->ctx, &tmp,
- bootp, bootp_len, (uint8_t)i) != 0)
+ !get_option(ifp->ctx, bootp, bootp_len, (uint8_t)i, NULL))
{
/* If we are BOOTP, then ignore the need for serverid.
* To ignore BOOTP, require dhcp_message_type.