chiark / gitweb /
sd-dhcp6-client: Implement Rapid Commit
[elogind.git] / src / libsystemd-network / dhcp6-option.c
index f488832cf919ca4406c3a192ee124b9b05cb8323..e9b382c17070c1266d213e11fe084703b3c68fcd 100644 (file)
@@ -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;