naccyde / rpms / systemd

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