diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-10-01 15:31:50 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-10-02 23:05:05 +0900 |
commit | 4ec5b5c7785b21d958118cb741c98654bcb9e25a (patch) | |
tree | bf8e6cee41735d4eedb61e8e98dc16b9cb05aae6 /src/libsystemd-network/dhcp6-option.c | |
parent | 93ed1c0eb9b9434ffc292f09f533dc0decad6318 (diff) | |
download | systemd-4ec5b5c7785b21d958118cb741c98654bcb9e25a.tar.gz |
sd-dhcp6-client: make dhcp6_option_append_fqdn() or friends handle zero length value gracefully
Diffstat (limited to 'src/libsystemd-network/dhcp6-option.c')
-rw-r--r-- | src/libsystemd-network/dhcp6-option.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libsystemd-network/dhcp6-option.c b/src/libsystemd-network/dhcp6-option.c index 0d26aef234..4fd75fbf3b 100644 --- a/src/libsystemd-network/dhcp6-option.c +++ b/src/libsystemd-network/dhcp6-option.c @@ -256,7 +256,6 @@ int dhcp6_option_append_vendor_option(uint8_t **buf, size_t *buflen, OrderedSet assert(buf); assert(*buf); assert(buflen); - assert(vendor_options); ORDERED_SET_FOREACH(options, vendor_options) { _cleanup_free_ uint8_t *p = NULL; @@ -401,7 +400,9 @@ int dhcp6_option_append_fqdn(uint8_t **buf, size_t *buflen, const char *fqdn) { assert(buf); assert(*buf); assert(buflen); - assert(fqdn); + + if (isempty(fqdn)) + return 0; buffer[0] = DHCP6_FQDN_FLAG_S; /* Request server to perform AAAA RR DNS updates */ @@ -431,7 +432,9 @@ int dhcp6_option_append_user_class(uint8_t **buf, size_t *buflen, char * const * assert(buf); assert(*buf); assert(buflen); - assert(!strv_isempty(user_class)); + + if (strv_isempty(user_class)) + return 0; STRV_FOREACH(s, user_class) { size_t len = strlen(*s); @@ -463,7 +466,9 @@ int dhcp6_option_append_vendor_class(uint8_t **buf, size_t *buflen, char * const assert(buf); assert(*buf); assert(buflen); - assert(!strv_isempty(vendor_class)); + + if (strv_isempty(vendor_class)) + return 0; enterprise_identifier = htobe32(SYSTEMD_PEN); |