1
0
mirror of https://github.com/systemd/systemd synced 2025-10-08 13:14:45 +02:00

Compare commits

..

2 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
828b603a79 libsystemd-network: fix dhcp option buffer confusion
We were writing to the wrong buffer with a wrong offset :(
Bug present since the original introduction of the code in
04b28be1a306fd2ba454d3ee333d63df71aa3873.
2021-04-15 13:46:48 +09:00
Sevan Janiyan
d5b3e51044 meson.build: typo 2021-04-15 13:23:13 +09:00
2 changed files with 3 additions and 2 deletions

View File

@ -802,7 +802,7 @@ if not meson.is_cross_build()
id = id_result.stdout().to_int() id = id_result.stdout().to_int()
if id != 65534 if id != 65534
warning('\n' + warning('\n' +
'The local group with the configured group name "@0@" of the nobody group does not have UID 65534 (it has @1@).\n'.format(nobody_group, id) + 'The local group with the configured group name "@0@" of the nobody group does not have GID 65534 (it has @1@).\n'.format(nobody_group, id) +
'Your build will result in an group table setup that is incompatible with the local system.') 'Your build will result in an group table setup that is incompatible with the local system.')
endif endif
endif endif

View File

@ -17,6 +17,7 @@
static int option_append(uint8_t options[], size_t size, size_t *offset, static int option_append(uint8_t options[], size_t size, size_t *offset,
uint8_t code, size_t optlen, const void *optval) { uint8_t code, size_t optlen, const void *optval) {
assert(options); assert(options);
assert(size > 0);
assert(offset); assert(offset);
if (code != SD_DHCP_OPTION_END) if (code != SD_DHCP_OPTION_END)
@ -165,7 +166,7 @@ int dhcp_option_append(DHCPMessage *message, size_t size, size_t *offset,
} else if (r == -ENOBUFS && use_sname) { } else if (r == -ENOBUFS && use_sname) {
/* did not fit, but we have more buffers to try /* did not fit, but we have more buffers to try
close the file array and move the offset to its end */ close the file array and move the offset to its end */
r = option_append(message->options, size, offset, SD_DHCP_OPTION_END, 0, NULL); r = option_append(message->file, sizeof(message->file), &file_offset, SD_DHCP_OPTION_END, 0, NULL);
if (r < 0) if (r < 0)
return r; return r;