Skip to content

Commit fdf759e

Browse files
committed
sd-dhcp6-client: fix DUID data length passed to hexmem()
Fixes a bug introduced by 6b7d5b6.
1 parent 1ae9a98 commit fdf759e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libsystemd-network/sd-dhcp6-client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ int sd_dhcp6_client_duid_as_string(
276276
int r;
277277

278278
assert_return(client, -EINVAL);
279-
assert_return(client->duid_len > 0, -ENODATA);
279+
assert_return(client->duid_len > offsetof(struct duid, raw.data), -ENODATA);
280280
assert_return(duid, -EINVAL);
281281

282282
v = duid_type_to_string(be16toh(client->duid.type));
@@ -290,7 +290,7 @@ int sd_dhcp6_client_duid_as_string(
290290
return -ENOMEM;
291291
}
292292

293-
t = hexmem(&client->duid.raw.data, client->duid_len);
293+
t = hexmem(client->duid.raw.data, client->duid_len - offsetof(struct duid, raw.data));
294294
if (!t)
295295
return -ENOMEM;
296296

0 commit comments

Comments
 (0)