mirror of
https://github.com/systemd/systemd.git
synced 2024-11-02 02:21:44 +03:00
Merge pull request #2937 from thom311/master
dhcp-identifier: handle too large duid_len argument in dhcp_validate_duid_len()
This commit is contained in:
commit
7aa610f149
@ -75,7 +75,7 @@ int dhcp_identifier_set_iaid(int ifindex, uint8_t *mac, size_t mac_len, void *_i
|
|||||||
static inline int dhcp_validate_duid_len(uint16_t duid_type, size_t duid_len) {
|
static inline int dhcp_validate_duid_len(uint16_t duid_type, size_t duid_len) {
|
||||||
struct duid d;
|
struct duid d;
|
||||||
|
|
||||||
assert_return(duid_len > 0 && duid_len <= MAX_DUID_LEN, -EINVAL);
|
assert(duid_len > 0);
|
||||||
|
|
||||||
switch (duid_type) {
|
switch (duid_type) {
|
||||||
case DUID_TYPE_LLT:
|
case DUID_TYPE_LLT:
|
||||||
@ -95,6 +95,8 @@ static inline int dhcp_validate_duid_len(uint16_t duid_type, size_t duid_len) {
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
if (duid_len > sizeof(d.raw))
|
||||||
|
return -EINVAL;
|
||||||
/* accept unknown type in order to be forward compatible */
|
/* accept unknown type in order to be forward compatible */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user