From: Nick Owens Date: Thu, 9 Jul 2015 19:51:55 +0000 (-0700) Subject: sd-dhcp-lease: fix handling of multiple routers X-Git-Tag: v223~103^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F538%2Fhead;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index d8bc76edda4..1150d041882 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;