[packages/dhcp] Rel 3. Fix print_hw_addr() overflow (CentOS Stream backport)

arekm arekm at pld-linux.org
Thu Oct 29 08:29:13 CET 2026


commit cf1e76d5d018456b7163adba37a7293bc96a9759
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Oct 29 01:03:16 2026 +0100

    Rel 3. Fix print_hw_addr() overflow (CentOS Stream backport)
    
    Fixes CVE-2026-18103.

 CVE-2026-18103.patch | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 dhcp.spec            |  8 ++++--
 2 files changed, 79 insertions(+), 2 deletions(-)
---
diff --git a/dhcp.spec b/dhcp.spec
index 5205ba2..ca677ee 100644
--- a/dhcp.spec
+++ b/dhcp.spec
@@ -23,11 +23,11 @@ Summary(pl.UTF-8):	Serwer DHCP
 Summary(pt_BR.UTF-8):	Servidor DHCP (Protocolo de configuração dinâmica de hosts)
 Name:		dhcp
 Version:	%{ver}%{pverdot}
-Release:	2
+Release:	3
 Epoch:		4
 License:	MIT
 Group:		Networking/Daemons
-Source0:	ftp://ftp.isc.org/isc/dhcp/%{ver}%{pverdir}/%{name}-%{ver}%{pverdir}.tar.gz
+Source0:	https://downloads.isc.org/isc/dhcp/%{ver}%{pverdir}/%{name}-%{ver}%{pverdir}.tar.gz
 # Source0-md5:	36c6ca77212373b0cff478ae9e5d32af
 Source1:	%{name}.init
 Source2:	%{name}6.init
@@ -73,6 +73,7 @@ Patch28:	%{name}-detect-time-changes.patch
 Patch29:	bind-detect-time-changes.patch
 Patch30:	bind-system-getaddrinfo.patch
 Patch31:	declarations-fix.patch
+Patch32:	CVE-2026-18103.patch
 URL:		https://www.isc.org/dhcp/
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -261,6 +262,7 @@ komunikacji z działającym serwerem ISC DHCP i jego kontroli.
 %patch -P27 -p1
 %patch -P28 -p1
 %patch -P31 -p1
+%patch -P32 -p1
 
 cd bind
 tar -xvf bind.tar.gz
@@ -338,6 +340,8 @@ install client/scripts/linux $RPM_BUILD_ROOT/sbin/dhclient-script
 
 install server/dhcpd.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd.conf
 install doc/examples/dhcpd-dhcpv6.conf $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd6.conf
+# make install puts the examples into /etc; they are packaged as %doc
+rm $RPM_BUILD_ROOT%{_sysconfdir}/{dhclient,dhcpd}.conf.example
 
 %if %{with ldap}
 install -d $RPM_BUILD_ROOT%{schemadir}
diff --git a/CVE-2026-18103.patch b/CVE-2026-18103.patch
new file mode 100644
index 0000000..e8e8aec
--- /dev/null
+++ b/CVE-2026-18103.patch
@@ -0,0 +1,73 @@
+From: Martin Osvald <mosvald at redhat.com>
+Date: Thu, 2 Apr 2026 11:10:56 +0200
+Subject: [PATCH] Fix buffer overflow in print_hw_addr() (downstream-only, upstream EOL)
+
+The existing print_hw_addr() helper uses a fixed 49-byte buffer, which is
+too small for longer hardware addresses such as InfiniBand (20 bytes). This
+can overflow the static output buffer when formatting addresses as
+colon-separated hexadecimal bytes.
+
+This is CVE-2026-18103: an overly long hardware address (e.g. via OMAPI
+lease creation, or an InfiniBand client identifier) overflows habuf.
+Source: https://gitlab.com/redhat/centos-stream/rpms/dhcp/-/commit/c4ef4d9a2c817268b3aa69cfff9e2d672febed0a
+
+Signed-off-by: Martin Osvald <mosvald at redhat.com>
+diff --git a/common/print.c b/common/print.c
+index b42e7bc..7256714 100644
+--- a/common/print.c
++++ b/common/print.c
+@@ -170,23 +170,37 @@ char *print_base64 (const unsigned char *buf, unsigned len,
+ 
+ char *print_hw_addr (htype, hlen, data)
+ 	const int htype;
+-	const int hlen;
++	int hlen;
+ 	const unsigned char *data;
+ {
+-	static char habuf [49];
++	/* Buffer sized for InfiniBand (20 bytes): 20 * 3 = 60 chars
++	 * Each byte needs 3 chars "xx:", last ':' replaced by 0 */
++	static char habuf [60];
++	int max_bytes = sizeof(habuf) / 3;
+ 	char *s;
+ 	int i;
+ 
+-	if (hlen <= 0)
++	if (hlen <= 0 || data == NULL)
+ 		habuf [0] = 0;
+ 	else {
++		int orig_hlen = 0;
++		if (hlen > max_bytes) {
++			orig_hlen = hlen;
++			hlen = max_bytes;
++		}
++
+ 		s = habuf;
+ 		for (i = 0; i < hlen; i++) {
+ 			sprintf (s, "%02x", data [i]);
+-			s += strlen (s);
++			s += 2;
+ 			*s++ = ':';
+ 		}
+ 		*--s = 0;
++
++		if (orig_hlen) {
++			log_error("Hardware address %s truncated from %d to %d bytes",
++					habuf, orig_hlen, max_bytes);
++		}
+ 	}
+ 	return habuf;
+ }
+diff --git a/includes/dhcpd.h b/includes/dhcpd.h
+index 14161c3..5b1dfd8 100644
+--- a/includes/dhcpd.h
++++ b/includes/dhcpd.h
+@@ -2618,7 +2618,7 @@ char *quotify_string (const char *, const char *, int);
+ char *quotify_buf (const unsigned char *, unsigned, const char,
+ 		   const char *, int);
+ char *print_base64 (const unsigned char *, unsigned, const char *, int);
+-char *print_hw_addr (const int, const int, const unsigned char *);
++char *print_hw_addr (const int, int, const unsigned char *);
+ void print_lease (struct lease *);
+ void dump_raw (const unsigned char *, unsigned);
+ void dump_packet_option (struct option_cache *, struct packet *,
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/dhcp.git/commitdiff/cf1e76d5d018456b7163adba37a7293bc96a9759



More information about the pld-cvs-commit mailing list