Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python312 for openSUSE:Factory checked in at 2026-11-25 16:12:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python312 (Old) and /work/SRC/openSUSE:Factory/.python312.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python312" Wed Nov 25 16:12:07 2026 rev:58 rq:1400212 version:3.12.16 Changes: -------- --- /work/SRC/openSUSE:Factory/python312/python312.changes 2026-11-16 09:11:13.905744887 +0100 +++ /work/SRC/openSUSE:Factory/.python312.new.1340718/python312.changes 2026-11-25 16:12:42.320746712 +0100 @@ -1,0 +2,14 @@ +Mon Nov 23 11:45:31 UTC 2026 - Matej Cepl <[email protected]> + +- CVE-2026-103995: Validate http.client Content-Length and + chunk-size per RFC 9112 (bsc#1288328) + CVE-2026-103995-http-framing-validation.patch + +------------------------------------------------------------------- +Fri Nov 20 14:19:43 UTC 2026 - Matej Cepl <[email protected]> + +- CVE-2026-116566: Reject null bytes in socket.getaddrinfo() host + and port (bsc#1289106) + CVE-2026-116566-getaddrinfo-null-bytes.patch + +------------------------------------------------------------------- New: ---- CVE-2026-103995-http-framing-validation.patch CVE-2026-116566-getaddrinfo-null-bytes.patch ----------(New B)---------- New: chunk-size per RFC 9112 (bsc#1288328) CVE-2026-103995-http-framing-validation.patch New: and port (bsc#1289106) CVE-2026-116566-getaddrinfo-null-bytes.patch ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python312.spec ++++++ --- /var/tmp/diff_new_pack.9xKAEf/_old 2026-11-25 16:12:43.853811756 +0100 +++ /var/tmp/diff_new_pack.9xKAEf/_new 2026-11-25 16:12:43.855811841 +0100 @@ -219,6 +219,12 @@ Patch80: bsc1263083-http-cookies-atob-utf8.patch # PATCH-FIX-OPENSUSE: Accept socket resets in the TLS 1.3 client-cert test Patch81: test_ssl_tls13_connection_reset.patch +# PATCH-FIX-UPSTREAM CVE-2026-116566-getaddrinfo-null-bytes.patch bsc#1289106 [email protected] +# Reject null bytes in socket.getaddrinfo() host and port +Patch82: CVE-2026-116566-getaddrinfo-null-bytes.patch +# PATCH-FIX-UPSTREAM CVE-2026-103995-http-framing-validation.patch bsc#1288328 [email protected] +# Validate http.client Content-Length and chunk-size per RFC 9112 +Patch83: CVE-2026-103995-http-framing-validation.patch ### END OF PATCHES BuildRequires: autoconf-archive BuildRequires: automake ++++++ CVE-2026-103995-http-framing-validation.patch ++++++ From: metsw24-max <[email protected]> Subject: gh-150751: validate http.client Content-Length and chunk-size (GH-150752) RFC 9112 defines Content-Length as 1*DIGIT and chunk-size as 1*HEXDIG, but int() also accepts a sign, underscores, surrounding whitespace and an 0x prefix, so malformed framing values were parsed instead of rejected. Optional SP/HTAB whitespace around the Content-Length value is ignored per RFC 9112 section 5.1 (gh-150751, GH-159156). Patch taken from https://github.com/python/cpython/pull/160772 . --- Index: Python-3.12.16/Lib/http/client.py =================================================================== --- Python-3.12.16.orig/Lib/http/client.py 2026-11-23 12:25:47.223749863 +0100 +++ Python-3.12.16/Lib/http/client.py 2026-11-23 12:33:12.100479917 +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'} @@ -383,14 +388,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 @@ -557,7 +560,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.12.16/Lib/test/test_httplib.py =================================================================== --- Python-3.12.16.orig/Lib/test/test_httplib.py 2026-11-23 12:25:47.223749863 +0100 +++ Python-3.12.16/Lib/test/test_httplib.py 2026-11-23 12:33:12.106479981 +0100 @@ -1260,6 +1260,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.12.16/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.12.16/Misc/NEWS.d/next/Library/2026-06-02-13-10-00.gh-issue-150751.Hk2Vw9.rst 2026-11-23 12:33:12.107479992 +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. ++++++ CVE-2026-116566-getaddrinfo-null-bytes.patch ++++++ >From 14815082af8f3c21bd50800030faed37c76296cb Mon Sep 17 00:00:00 2001 From: Seth Larson <[email protected]> Date: Thu, 29 Oct 2026 12:15:29 -0500 Subject: [PATCH] [3.12] gh-160898: Reject null bytes in `socket.getaddrinfo()` host and port (GH-160899) (cherry picked from commit 131a3a66c5f400b588f9fd2732a5ed4e89623ee3) (cherry picked from commit ee60d5db8f1668db57f3fc46b97ecf6cd0e251ac) (cherry picked from commit 589379e4f11e07c15269dfc00dae2bd648e2b4da) 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.12.16/Doc/library/socket.rst =================================================================== --- Python-3.12.16.orig/Doc/library/socket.rst 2026-11-20 15:16:04.419648143 +0100 +++ Python-3.12.16/Doc/library/socket.rst 2026-11-20 15:18:25.374111033 +0100 @@ -992,6 +992,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.12.16/Lib/test/test_socket.py =================================================================== --- Python-3.12.16.orig/Lib/test/test_socket.py 2026-10-25 19:24:37.000000000 +0100 +++ Python-3.12.16/Lib/test/test_socket.py 2026-11-20 15:18:25.378111103 +0100 @@ -1923,6 +1923,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.12.16/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.12.16/Misc/NEWS.d/next/Security/2026-10-27-16-25-40.gh-issue-160898.epi53X.rst 2026-11-20 15:18:25.379524611 +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.12.16/Modules/socketmodule.c =================================================================== --- Python-3.12.16.orig/Modules/socketmodule.c 2026-10-25 19:24:37.000000000 +0100 +++ Python-3.12.16/Modules/socketmodule.c 2026-11-20 15:18:25.383111191 +0100 @@ -6746,6 +6746,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; @@ -6766,33 +6767,46 @@ 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 (PyLong_CheckExact(pobj)) { pstr = PyObject_Str(pobj); 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.9xKAEf/_old 2026-11-25 16:12:44.004818163 +0100 +++ /var/tmp/diff_new_pack.9xKAEf/_new 2026-11-25 16:12:44.009818375 +0100 @@ -1,6 +1,6 @@ -mtime: 1794005999 -commit: 8610ba5ccd4e2e69ea3e9d05731f059a9bea4eda1a4eea4e67dd90d15225af4d +mtime: 1795437037 +commit: 494800f55422045ff9757a25f92668c3fcd8dca8d57bea5df122c29452023044 url: https://src.opensuse.org/python-interpreters/python312 -revision: 8610ba5ccd4e2e69ea3e9d05731f059a9bea4eda1a4eea4e67dd90d15225af4d +revision: 494800f55422045ff9757a25f92668c3fcd8dca8d57bea5df122c29452023044 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:30:37.000000000 +0100 @@ -0,0 +1,6 @@ +_build.* +*.obscpio +*.osc +.osc +.pbuild +python312-3.12.*-build
