@@ -762,7 +762,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
762762 case 'i' :
763763 if (arg )
764764 s = parse_string ((char * )ifo -> vendorclassid + 1 ,
765- VENDORCLASSID_MAX_LEN , arg );
765+ sizeof ( ifo -> vendorclassid ) - 1 , arg );
766766 else
767767 s = 0 ;
768768 if (s == -1 ) {
@@ -1049,7 +1049,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
10491049 if (p == arg ) {
10501050 arg ++ ;
10511051 s = parse_string ((char * )ifo -> vendor + 1 ,
1052- VENDOR_MAX_LEN , arg );
1052+ sizeof ( ifo -> vendor ) - 1 , arg );
10531053 if (s == -1 ) {
10541054 logerr ("vendor" );
10551055 return -1 ;
@@ -1076,7 +1076,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
10761076 }
10771077
10781078 arg = p + 1 ;
1079- s = VENDOR_MAX_LEN - ifo -> vendor [0 ] - 2 ;
1079+ s = sizeof ( ifo -> vendor ) - 1 - ifo -> vendor [0 ] - 2 ;
10801080 if (inet_aton (arg , & addr ) == 1 ) {
10811081 if (s < 6 ) {
10821082 s = -1 ;
@@ -1203,11 +1203,13 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
12031203 ifo -> options |= DHCPCD_XID_HWADDR ;
12041204 break ;
12051205 case 'I' :
1206- /* Strings have a type of 0 */ ;
1207- ifo -> clientid [1 ] = 0 ;
12081206 if (arg )
1207+ /* If parse_hwaddr cannot decoded arg as a
1208+ * hardware address then the first byte
1209+ * in the clientid will be zero to indicate
1210+ * a string value. */
12091211 s = parse_hwaddr ((char * )ifo -> clientid + 1 ,
1210- CLIENTID_MAX_LEN , arg );
1212+ sizeof ( ifo -> clientid ) - 1 , arg );
12111213 else
12121214 s = 0 ;
12131215 if (s == -1 ) {
@@ -2469,7 +2471,8 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
24692471 break ;
24702472 case O_MUDURL :
24712473 ARG_REQUIRED ;
2472- s = parse_string ((char * )ifo -> mudurl + 1 , MUDURL_MAX_LEN , arg );
2474+ s = parse_string ((char * )ifo -> mudurl + 1 ,
2475+ sizeof (ifo -> mudurl ) - 1 , arg );
24732476 if (s == -1 ) {
24742477 logerr ("mudurl" );
24752478 return -1 ;
0 commit comments