summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-01 18:27:23 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-01 18:27:23 +0200
commit7aa610f1491fd361c269481701c9d07ac3f48ae6 (patch)
tree4b10ae036cf9d2ce08f4d2655455f6cc4f6d2fe5
parent2685875eb16f1681826ef5220c27223b2d10d7dc (diff)
parent7908dd6730693d7f6a09485b56de7eed0b77afbe (diff)
Merge pull request #2937 from thom311/master
dhcp-identifier: handle too large duid_len argument in dhcp_validate_duid_len()
-rw-r--r--src/libsystemd-network/dhcp-identifier.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsystemd-network/dhcp-identifier.h b/src/libsystemd-network/dhcp-identifier.h
index babae15c5b..e6486b78f8 100644
--- a/src/libsystemd-network/dhcp-identifier.h
+++ b/src/libsystemd-network/dhcp-identifier.h
@@ -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) {
struct duid d;
- assert_return(duid_len > 0 && duid_len <= MAX_DUID_LEN, -EINVAL);
+ assert(duid_len > 0);
switch (duid_type) {
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;
break;
default:
+ if (duid_len > sizeof(d.raw))
+ return -EINVAL;
/* accept unknown type in order to be forward compatible */
break;
}