@@ -304,7 +304,7 @@ get_option_uint32(struct dhcpcd_ctx *ctx,
304
304
uint32_t d ;
305
305
306
306
p = get_option (ctx , bootp , bootp_len , option , & len );
307
- if (!p || len < (ssize_t )sizeof (d ))
307
+ if (!p || len != (ssize_t )sizeof (d ))
308
308
return -1 ;
309
309
memcpy (& d , p , sizeof (d ));
310
310
if (i )
@@ -321,7 +321,7 @@ get_option_uint16(struct dhcpcd_ctx *ctx,
321
321
uint16_t d ;
322
322
323
323
p = get_option (ctx , bootp , bootp_len , option , & len );
324
- if (!p || len < (ssize_t )sizeof (d ))
324
+ if (!p || len != (ssize_t )sizeof (d ))
325
325
return -1 ;
326
326
memcpy (& d , p , sizeof (d ));
327
327
if (i )
@@ -337,7 +337,7 @@ get_option_uint8(struct dhcpcd_ctx *ctx,
337
337
size_t len ;
338
338
339
339
p = get_option (ctx , bootp , bootp_len , option , & len );
340
- if (!p || len < (ssize_t )sizeof (* p ))
340
+ if (!p || len != (ssize_t )sizeof (* p ))
341
341
return -1 ;
342
342
if (i )
343
343
* i = * (p );
@@ -3158,8 +3158,7 @@ dhcp_handledhcp(struct interface *ifp, struct bootp *bootp, size_t bootp_len,
3158
3158
/* Ensure that no reject options are present */
3159
3159
for (i = 1 ; i < 255 ; i ++ ) {
3160
3160
if (has_option_mask (ifo -> rejectmask , i ) &&
3161
- get_option_uint8 (ifp -> ctx , & tmp ,
3162
- bootp , bootp_len , (uint8_t )i ) == 0 )
3161
+ get_option (ifp -> ctx , bootp , bootp_len , (uint8_t )i , NULL ))
3163
3162
{
3164
3163
LOGDHCP (LOG_WARNING , "reject DHCP" );
3165
3164
return ;
@@ -3207,8 +3206,7 @@ dhcp_handledhcp(struct interface *ifp, struct bootp *bootp, size_t bootp_len,
3207
3206
/* Ensure that all required options are present */
3208
3207
for (i = 1 ; i < 255 ; i ++ ) {
3209
3208
if (has_option_mask (ifo -> requiremask , i ) &&
3210
- get_option_uint8 (ifp -> ctx , & tmp ,
3211
- bootp , bootp_len , (uint8_t )i ) != 0 )
3209
+ !get_option (ifp -> ctx , bootp , bootp_len , (uint8_t )i , NULL ))
3212
3210
{
3213
3211
/* If we are BOOTP, then ignore the need for serverid.
3214
3212
* To ignore BOOTP, require dhcp_message_type.
0 commit comments