summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Owens <mischief@coreos.com>2015-07-09 12:51:55 -0700
committerNick Owens <mischief@coreos.com>2015-07-11 15:37:01 -0700
commita05185279bfc2420f60dc2a061d50bfcb646be70 (patch)
treee7163e5c3b5f0cf73d46619e521f4f0ede897aaa
parent9a50ce20ef60263a6c88c29470ce761fcc424f2d (diff)
sd-dhcp-lease: fix handling of multiple routers
currently if a dhcp server sends more than one router, sd-dhcp-lease does not copy the ip because it assumes it will only ever be 4 bytes. a dhcp server could send more than one ip in the router list, so we should copy the first one and ignore the rest of the bytes.
-rw-r--r--src/libsystemd-network/sd-dhcp-lease.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index d8bc76edda..1150d04188 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -435,7 +435,8 @@ int dhcp_lease_parse_options(uint8_t code, uint8_t len, const uint8_t *option,
break;
case DHCP_OPTION_ROUTER:
- lease_parse_be32(option, len, &lease->router);
+ if(len >= 4)
+ lease_parse_be32(option, 4, &lease->router);
break;