mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-20 14:03:39 +03:00
sd-dhcp: make sure we can not fill options so much that there is no space for END
This commit is contained in:
parent
f5602be9da
commit
2688ef60de
@ -31,6 +31,10 @@ int dhcp_option_append(uint8_t options[], size_t size, size_t *offset,
|
||||
assert(options);
|
||||
assert(offset);
|
||||
|
||||
if (code != DHCP_OPTION_END)
|
||||
/* always make sure there is space for an END option */
|
||||
size --;
|
||||
|
||||
switch (code) {
|
||||
|
||||
case DHCP_OPTION_PAD:
|
||||
|
@ -85,7 +85,7 @@ static void test_invalid_buffer_length(void)
|
||||
static void test_message_init(void)
|
||||
{
|
||||
_cleanup_free_ DHCPMessage *message = NULL;
|
||||
size_t optlen = 3, optoffset;
|
||||
size_t optlen = 4, optoffset;
|
||||
size_t len = sizeof(DHCPMessage) + optlen;
|
||||
uint8_t *magic;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user