923a60
From 64383aae90fe4a1c1b5c4e4098e924c0e2623471 Mon Sep 17 00:00:00 2001
923a60
From: Jan Synacek <jsynacek@redhat.com>
923a60
Date: Thu, 1 Nov 2018 13:11:11 +0100
923a60
Subject: [PATCH] dhcp6: make sure we have enough space for the DHCP6 option
923a60
 header
923a60
923a60
Fixes a vulnerability originally discovered by Felix Wilhelm from Google.
923a60
923a60
(cherry picked from commit 01ca2053bbea09f35b958c8cc7631e15469acb79)
923a60
923a60
Resolves: CVE-2018-15688
923a60
---
923a60
 src/libsystemd-network/dhcp6-option.c | 2 +-
923a60
 1 file changed, 1 insertion(+), 1 deletion(-)
923a60
923a60
diff --git a/src/libsystemd-network/dhcp6-option.c b/src/libsystemd-network/dhcp6-option.c
923a60
index ea863f45e4..649bbea304 100644
923a60
--- a/src/libsystemd-network/dhcp6-option.c
923a60
+++ b/src/libsystemd-network/dhcp6-option.c
923a60
@@ -100,7 +100,7 @@ int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, DHCP6IA *ia) {
923a60
                 return -EINVAL;
923a60
         }
923a60
 
923a60
-        if (*buflen < len)
923a60
+        if (*buflen < offsetof(DHCP6Option, data) + len)
923a60
                 return -ENOBUFS;
923a60
 
923a60
         ia_hdr = *buf;