]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-dhcp-lease: fix handling of multiple routers 538/head
authorNick Owens <mischief@coreos.com>
Thu, 9 Jul 2015 19:51:55 +0000 (12:51 -0700)
committerNick Owens <mischief@coreos.com>
Sat, 11 Jul 2015 22:37:01 +0000 (15:37 -0700)
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.

src/libsystemd-network/sd-dhcp-lease.c

index d8bc76edda4b9efa4cf33b250c4d8aa00cd640e9..1150d04188245ce6fb6a827f783eb4371415a714 100644 (file)
@@ -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;