X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd-network%2Fdhcp6-option.c;fp=src%2Flibsystemd-network%2Fdhcp6-option.c;h=e9b382c17070c1266d213e11fe084703b3c68fcd;hb=ed6ee21953dac9c78383da00bc4514ece6b75ab5;hp=f488832cf919ca4406c3a192ee124b9b05cb8323;hpb=3dc34fcc97b41f8b7b019027225b121dfbb9871d;p=elogind.git diff --git a/src/libsystemd-network/dhcp6-option.c b/src/libsystemd-network/dhcp6-option.c index f488832cf..e9b382c17 100644 --- a/src/libsystemd-network/dhcp6-option.c +++ b/src/libsystemd-network/dhcp6-option.c @@ -58,13 +58,14 @@ int dhcp6_option_append(uint8_t **buf, size_t *buflen, uint16_t code, size_t optlen, const void *optval) { int r; - assert_return(optval, -EINVAL); + assert_return(optval || optlen == 0, -EINVAL); r = option_append_hdr(buf, buflen, code, optlen); if (r < 0) return r; - memcpy(*buf, optval, optlen); + if (optval) + memcpy(*buf, optval, optlen); *buf += optlen; *buflen -= optlen;