diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-06-19 09:00:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-19 09:00:52 +0200 |
commit | a4eb991831099756e9debc2cfeaf689584deed08 (patch) | |
tree | 38bc0bd626ccf4fc837f1256c7fd4e1239d24ca9 | |
parent | a057135bceef2d8e1efa52f8693bd478385d0049 (diff) | |
parent | bccd91629213eba8e4f324387dee619a008ecb2f (diff) | |
download | systemd-a4eb991831099756e9debc2cfeaf689584deed08.tar.gz |
Merge pull request #12829 from yuwata/dhcp-memdup_suffix0
sd-bus,dhcp: use memdup_suffix0() instead of strndup()
-rw-r--r-- | src/libsystemd-network/dhcp-option.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-message.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/libsystemd-network/dhcp-option.c b/src/libsystemd-network/dhcp-option.c index a68de4ff98..0abb8fdef0 100644 --- a/src/libsystemd-network/dhcp-option.c +++ b/src/libsystemd-network/dhcp-option.c @@ -198,7 +198,7 @@ static int parse_options(const uint8_t options[], size_t buflen, uint8_t *overlo 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; diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index 774bf10219..5360bce904 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -5265,7 +5265,7 @@ int bus_message_parse_fields(sd_bus_message *m) { if (!b) return -EBADMSG; - sig = strndup(b+1, item_size - (b+1-(char*) q)); + sig = memdup_suffix0(b+1, item_size - (b+1-(char*) q)); if (!sig) return -ENOMEM; |