]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dhcp4: use memdup_suffix0() instead of strndup() for binary data
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 30 May 2019 01:32:36 +0000 (10:32 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 30 May 2019 07:55:57 +0000 (09:55 +0200)
C.f. ac0a94f7438b49a0890d9806db1fa211a5bca10a.

Fixes #12693.

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

index c089b4278b17851ef203a4dd4dd806e37c26c021..17b2bb7aa4efd4f1b62430445bb3cf93292c37d4 100644 (file)
@@ -333,7 +333,7 @@ static int lease_parse_string(const uint8_t *option, size_t len, char **ret) {
                 if (memchr(option, 0, len - 1))
                         return -EINVAL;
 
-                string = strndup((const char *) option, len);
+                string = memdup_suffix0((const char *) option, len);
                 if (!string)
                         return -ENOMEM;