From 2688ef60de061bf188c1153c58fb41a78919b97e Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Wed, 21 May 2014 15:27:53 +0200 Subject: sd-dhcp: make sure we can not fill options so much that there is no space for END --- src/libsystemd-network/dhcp-option.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/libsystemd-network/dhcp-option.c') diff --git a/src/libsystemd-network/dhcp-option.c b/src/libsystemd-network/dhcp-option.c index 68950923dd..24f678c100 100644 --- a/src/libsystemd-network/dhcp-option.c +++ b/src/libsystemd-network/dhcp-option.c @@ -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: -- cgit v1.2.3-54-g00ecf