summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/dhcp-option.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-05-21 15:27:53 +0200
committerTom Gundersen <teg@jklm.no>2014-05-21 15:27:53 +0200
commit2688ef60de061bf188c1153c58fb41a78919b97e (patch)
treea9f537b1475a59ef71a75755fd8460d5a2b32c8d /src/libsystemd-network/dhcp-option.c
parentf5602be9da8ba0c0cc4865398aa7fa99ad447d56 (diff)
sd-dhcp: make sure we can not fill options so much that there is no space for END
Diffstat (limited to 'src/libsystemd-network/dhcp-option.c')
-rw-r--r--src/libsystemd-network/dhcp-option.c4
1 files changed, 4 insertions, 0 deletions
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: