Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python315 for openSUSE:Factory checked in at 2026-11-24 12:39:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python315 (Old) and /work/SRC/openSUSE:Factory/.python315.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python315" Tue Nov 24 12:39:57 2026 rev:24 rq:1400065 version:3.15.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python315/python315.changes 2026-10-29 20:36:07.652053610 +0100 +++ /work/SRC/openSUSE:Factory/.python315.new.1340718/python315.changes 2026-11-24 12:46:05.100415184 +0100 @@ -1,0 +2,14 @@ +Mon Nov 23 11:55:55 UTC 2026 - Matej Cepl <[email protected]> + +- CVE-2026-103995: validate http.client Content-Length and + chunk-size (GH-150752) (bsc#1288328) + CVE-2026-103995-http-client-content-length.patch + +------------------------------------------------------------------- +Thu Nov 19 12:28:47 UTC 2026 - Matej Cepl <[email protected]> + +- CVE-2026-116566: Reject null bytes in socket.getaddrinfo() + host and port (GH-160899) (bsc#1289106) + CVE-2026-116566-reject-null-bytes-getaddrinfo.patch + +------------------------------------------------------------------- New: ---- CVE-2026-103995-http-client-content-length.patch CVE-2026-116566-reject-null-bytes-getaddrinfo.patch ----------(New B)---------- New: chunk-size (GH-150752) (bsc#1288328) CVE-2026-103995-http-client-content-length.patch New: host and port (GH-160899) (bsc#1289106) CVE-2026-116566-reject-null-bytes-getaddrinfo.patch ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python315.spec ++++++ --- /var/tmp/diff_new_pack.8uWCLz/_old 2026-11-24 12:46:08.126543435 +0100 +++ /var/tmp/diff_new_pack.8uWCLz/_new 2026-11-24 12:46:08.133543732 +0100 @@ -230,6 +230,12 @@ # PATCH-FIX-OPENSUSE test_UDPLITE_support.patch gh#python/cpython#149078 [email protected] # improve testing of the presence of IPPROTO_UDPLITE support Patch49: test_UDPLITE_support.patch +# PATCH-FIX-UPSTREAM CVE-2026-116566-reject-null-bytes-getaddrinfo.patch bsc#1289106 [email protected] +# Reject null bytes in socket.getaddrinfo() host and port (GH-160899) +Patch50: CVE-2026-116566-reject-null-bytes-getaddrinfo.patch +# PATCH-FIX-UPSTREAM CVE-2026-103995-http-client-content-length.patch bsc#1288328 [email protected] +# validate http.client Content-Length and chunk-size (GH-150752) +Patch51: CVE-2026-103995-http-client-content-length.patch #### Python 3.15 DEVELOPMENT PATCHES BuildRequires: autoconf-archive BuildRequires: automake ++++++ CVE-2026-103995-http-client-content-length.patch ++++++ Index: Python-3.15.2/Lib/http/client.py =================================================================== --- Python-3.15.2.orig/Lib/http/client.py 2026-10-29 14:16:09.139997608 +0100 +++ Python-3.15.2/Lib/http/client.py 2026-11-23 12:23:25.797889184 +0100 @@ -165,6 +165,11 @@ # to prevent http header injection. _contains_disallowed_method_pchar_re = re.compile('[\x00-\x1f]') +# RFC 9112: Content-Length = 1*DIGIT and chunk-size = 1*HEXDIG. +# int() is more permissive, so we match against the grammar before calling it. +_is_legal_content_length = re.compile(r'[0-9]+').fullmatch +_is_legal_chunk_size = re.compile(rb'[0-9a-fA-F]+').fullmatch + # We always set the Content-Length header for these methods because some # servers will otherwise respond with a 411 _METHODS_EXPECTING_BODY = {'PATCH', 'POST', 'PUT'} @@ -392,14 +397,12 @@ # NOTE: RFC 2616, S4.4, #3 says we ignore this if tr_enc is "chunked" self.length = None length = self.headers.get("content-length") - if length and not self.chunked: - try: - self.length = int(length) - except ValueError: - self.length = None - else: - if self.length < 0: # ignore nonsensical negative lengths - self.length = None + if length is not None: + # RFC 9112, section 5.1: optional whitespace (SP / HTAB) around + # the field value is not part of the value. + length = length.strip(' \t') + if length and not self.chunked and _is_legal_content_length(length): + self.length = int(length) else: self.length = None @@ -566,7 +569,10 @@ i = line.find(b";") if i >= 0: line = line[:i] # strip chunk-extensions + line = line.rstrip() try: + if not _is_legal_chunk_size(line): + raise ValueError("invalid chunk size") return int(line, 16) except ValueError: # close the connection as protocol synchronisation is Index: Python-3.15.2/Lib/test/test_httplib.py =================================================================== --- Python-3.15.2.orig/Lib/test/test_httplib.py 2026-10-29 14:16:11.937254312 +0100 +++ Python-3.15.2/Lib/test/test_httplib.py 2026-11-23 12:23:25.802230442 +0100 @@ -1348,6 +1348,49 @@ self.assertEqual(resp.read(), b'Hello\r\n') self.assertTrue(resp.isclosed()) + def test_malformed_content_length(self): + # RFC 9112: Content-Length = 1*DIGIT. Values that int() accepts but + # the grammar forbids must not be used to frame the body. + for value in ('+5', '5_0', '5 0'): + with self.subTest(value=value): + sock = FakeSocket( + 'HTTP/1.1 200 OK\r\nContent-Length: %s\r\n\r\nHello\r\n' % value) + resp = client.HTTPResponse(sock, method="GET") + resp.begin() + self.assertIsNone(resp.length) + self.assertEqual(resp.read(), b'Hello\r\n') + resp.close() + + def test_content_length_with_whitespace(self): + # RFC 9112, section 5.1: optional whitespace (SP / HTAB) around + # the field value is not part of the value, so it must not + # prevent the Content-Length from being used to frame the body. + for value in ('7 ', '7\t', '7 \t ', ' 7 '): + with self.subTest(value=value): + sock = FakeSocket( + 'HTTP/1.1 200 OK\r\nContent-Length: %s\r\n\r\n' + 'Hello\r\nextra' % value) + resp = client.HTTPResponse(sock, method="GET") + resp.begin() + self.assertEqual(resp.length, 7) + self.assertEqual(resp.read(), b'Hello\r\n') + self.assertTrue(resp.isclosed()) + resp.close() + + def test_malformed_chunk_size(self): + # RFC 9112: chunk-size = 1*HEXDIG. Reject sizes that int(_, 16) accepts + # but the grammar forbids (a sign, an "0x" prefix, underscores or + # leading whitespace). + start = 'HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n' + for size in ('-5', '+5', '0x5', '1_f', ' 5'): + with self.subTest(size=size): + sock = FakeSocket(start + '%s\r\nHELLO\r\n0\r\n\r\n' % size) + resp = client.HTTPResponse(sock, method="GET") + resp.begin() + self.assertRaises(client.IncompleteRead, resp.read) + self.assertTrue(resp.isclosed()) + resp.close() + def test_incomplete_read(self): sock = FakeSocket('HTTP/1.1 200 OK\r\nContent-Length: 10\r\n\r\nHello\r\n') resp = client.HTTPResponse(sock, method="GET") Index: Python-3.15.2/Misc/NEWS.d/next/Library/2026-06-02-13-10-00.gh-issue-150751.Hk2Vw9.rst =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ Python-3.15.2/Misc/NEWS.d/next/Library/2026-06-02-13-10-00.gh-issue-150751.Hk2Vw9.rst 2026-11-23 12:23:25.803494070 +0100 @@ -0,0 +1,5 @@ +:mod:`http.client` now validates the ``Content-Length`` header and the +chunked ``chunk-size`` against the RFC 9112 grammar (``1*DIGIT`` and +``1*HEXDIG``) before parsing them, rejecting values such as ``+5``, ``5_0`` +or a ``0x``-prefixed or negative chunk size that :func:`int` would otherwise +accept. This avoids framing a response differently from a strict peer. Index: Python-3.15.2/Misc/NEWS.d/next/Library/2026-10-10-22-14-22.gh-issue-150751.JInuGL.rst =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ Python-3.15.2/Misc/NEWS.d/next/Library/2026-10-10-22-14-22.gh-issue-150751.JInuGL.rst 2026-11-23 12:23:25.804001077 +0100 @@ -0,0 +1,5 @@ +:mod:`http.client` now ignores optional whitespace around the +``Content-Length`` header value when validating it, as required by +:rfc:`9112`. Previously a value with trailing whitespace (for example +``Content-Length: 5`` followed by a space) was treated as missing and the +response body was read until the connection was closed. ++++++ CVE-2026-116566-reject-null-bytes-getaddrinfo.patch ++++++ >From ee60d5db8f1668db57f3fc46b97ecf6cd0e251ac Mon Sep 17 00:00:00 2001 From: Seth Larson <[email protected]> Date: Thu, 29 Oct 2026 12:15:29 -0500 Subject: [PATCH] [3.15] gh-160898: Reject null bytes in `socket.getaddrinfo()` host and port (GH-160899) (cherry picked from commit 131a3a66c5f400b588f9fd2732a5ed4e89623ee3) Co-authored-by: Seth Larson <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]> --- Doc/library/socket.rst | 3 ++ Lib/test/test_socket.py | 33 +++++++++++++++++++ ...-10-27-16-25-40.gh-issue-160898.epi53X.rst | 4 +++ Modules/socketmodule.c | 20 +++++++++-- 4 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 Misc/NEWS.d/next/Security/2026-10-27-16-25-40.gh-issue-160898.epi53X.rst Index: Python-3.15.2/Doc/library/socket.rst =================================================================== --- Python-3.15.2.orig/Doc/library/socket.rst 2026-10-25 17:57:51.000000000 +0100 +++ Python-3.15.2/Doc/library/socket.rst 2026-11-19 13:26:15.893609579 +0100 @@ -1065,6 +1065,9 @@ for IPv6 multicast addresses, string representing an address will not contain ``%scope_id`` part. + .. versionchanged:: next + Null characters are now rejected in the *host* and *port* parameters. + .. _Happy Eyeballs: https://en.wikipedia.org/wiki/Happy_Eyeballs .. function:: getfqdn([name]) Index: Python-3.15.2/Lib/test/test_socket.py =================================================================== --- Python-3.15.2.orig/Lib/test/test_socket.py 2026-10-29 14:16:19.994075629 +0100 +++ Python-3.15.2/Lib/test/test_socket.py 2026-11-19 13:26:15.895609610 +0100 @@ -2100,6 +2100,39 @@ nameinfo = socket.getnameinfo(sockaddr, socket.NI_NUMERICHOST | socket.NI_NUMERICSERV) self.assertEqual(nameinfo, ('ff02::1de:c0:face:8d%' + str(ifindex), '1234')) + def test_getaddrinfo_null_bytes(self): + # getaddrinfo() must reject embedded null bytes instead of silently + # truncating the host or port at the C boundary. The checks run + # before any name resolution, so no network access is needed. + hosts = [ + # embedded + 'local\0host', b'local\0host', + # trailing + 'localhost\0', b'localhost\0', + # leading (truncates to '') + '\0localhost', b'\0localhost', + '\0', b'\0', + # non-ASCII, goes through IDNA + 'b\xfccher\0.example', + ] + for host in hosts: + with self.subTest(host=host): + with self.assertRaisesRegex(ValueError, 'host'): + socket.getaddrinfo(host, 80) + + ports = [ + '8\x000', + b'8\x000', + 'http\0', + b'http\0', + '\0', + b'\0' + ] + for port in ports: + with self.subTest(port=port): + with self.assertRaisesRegex(ValueError, 'port'): + socket.getaddrinfo("localhost", port) + def test_str_for_enums(self): # Make sure that the AF_* and SOCK_* constants have enum-like string # reprs. Index: Python-3.15.2/Misc/NEWS.d/next/Security/2026-10-27-16-25-40.gh-issue-160898.epi53X.rst =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ Python-3.15.2/Misc/NEWS.d/next/Security/2026-10-27-16-25-40.gh-issue-160898.epi53X.rst 2026-11-19 13:26:15.897746171 +0100 @@ -0,0 +1,4 @@ +.. cve: CVE-2026-116566 + +:func:`socket.getaddrinfo` now rejects null bytes within *host* and *port* +parameters as this previously caused the values to be silently truncated. Index: Python-3.15.2/Modules/socketmodule.c =================================================================== --- Python-3.15.2.orig/Modules/socketmodule.c 2026-10-25 17:57:51.000000000 +0100 +++ Python-3.15.2/Modules/socketmodule.c 2026-11-19 13:26:15.899469871 +0100 @@ -6935,6 +6935,7 @@ PyObject *pobj = (PyObject *)NULL; PyObject *pstr = NULL; const char *hptr, *pptr; + Py_ssize_t hlen = 0, plen = 0; int family, socktype, protocol, flags; int error; PyObject *all = (PyObject *)NULL; @@ -6955,13 +6956,20 @@ return NULL; assert(PyBytes_Check(idna)); hptr = PyBytes_AS_STRING(idna); + hlen = PyBytes_GET_SIZE(idna); } else if (PyBytes_Check(hobj)) { - hptr = PyBytes_AsString(hobj); + hptr = PyBytes_AS_STRING(hobj); + hlen = PyBytes_GET_SIZE(hobj); } else { PyErr_SetString(PyExc_TypeError, "getaddrinfo() argument 1 must be string or None"); return NULL; } + if (hptr != NULL && strlen(hptr) != (size_t)hlen) { + PyErr_SetString(PyExc_ValueError, + "getaddrinfo() host must not contain null characters"); + goto err; + } if (PyIndex_Check(pobj)) { pstr = PyNumber_Index(pobj); if (pstr == NULL) @@ -6971,21 +6979,27 @@ if (pstr == NULL) goto err; assert(PyUnicode_Check(pstr)); - pptr = PyUnicode_AsUTF8(pstr); + pptr = PyUnicode_AsUTF8AndSize(pstr, &plen); if (pptr == NULL) goto err; } else if (PyUnicode_Check(pobj)) { - pptr = PyUnicode_AsUTF8(pobj); + pptr = PyUnicode_AsUTF8AndSize(pobj, &plen); if (pptr == NULL) goto err; } else if (PyBytes_Check(pobj)) { pptr = PyBytes_AS_STRING(pobj); + plen = PyBytes_GET_SIZE(pobj); } else if (pobj == Py_None) { pptr = (char *)NULL; } else { PyErr_SetString(PyExc_OSError, "Int or String expected"); goto err; } + if (pptr != NULL && strlen(pptr) != (size_t)plen) { + PyErr_SetString(PyExc_ValueError, + "getaddrinfo() port must not contain null characters"); + goto err; + } #if defined(__APPLE__) && defined(AI_NUMERICSERV) if ((flags & AI_NUMERICSERV) && (pptr == NULL || (pptr[0] == '0' && pptr[1] == 0))) { /* On OSX up to at least OSX 10.8 getaddrinfo crashes ++++++ _scmsync.obsinfo ++++++ --- /var/tmp/diff_new_pack.8uWCLz/_old 2026-11-24 12:46:08.479558396 +0100 +++ /var/tmp/diff_new_pack.8uWCLz/_new 2026-11-24 12:46:08.489558820 +0100 @@ -1,6 +1,6 @@ -mtime: 1793286421 -commit: a08517d29888914029ae4e894d4b4850773a661cda0595b96629656365622567 +mtime: 1795436984 +commit: 0e6e75c8660629a964dfb4c473b165396d2a9d21a6ff2ec238d20e4ac5e316bb url: https://src.opensuse.org/python-interpreters/python315 -revision: a08517d29888914029ae4e894d4b4850773a661cda0595b96629656365622567 +revision: 0e6e75c8660629a964dfb4c473b165396d2a9d21a6ff2ec238d20e4ac5e316bb projectscmsync: https://src.opensuse.org/python-interpreters/_ObsPrj ++++++ build.specials.obscpio ++++++ ++++++ build.specials.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.gitignore new/.gitignore --- old/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/.gitignore 2026-11-23 13:29:44.000000000 +0100 @@ -0,0 +1,5 @@ +*.obscpio +*.osc +_build.* +.pbuild +python315-*-build/
