Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python311 for openSUSE:Factory checked in at 2026-11-25 16:12:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python311 (Old) and /work/SRC/openSUSE:Factory/.python311.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python311" Wed Nov 25 16:12:09 2026 rev:78 rq:1400215 version:3.11.18 Changes: -------- --- /work/SRC/openSUSE:Factory/python311/python311.changes 2026-11-17 17:16:17.441225791 +0100 +++ /work/SRC/openSUSE:Factory/.python311.new.1340718/python311.changes 2026-11-25 16:12:44.747849688 +0100 @@ -1,0 +2,14 @@ +Mon Nov 23 11:26:02 UTC 2026 - Matej Cepl <[email protected]> + +- CVE-2026-103995: Validate http.client Content-Length and + chunk-size (bsc#1288328) + CVE-2026-103995-validate-http.client-Content-Length-chunk-size.patch + +------------------------------------------------------------------- +Fri Nov 20 14:39:47 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-validate-http.client-Content-Length-chunk-size.patch CVE-2026-116566-getaddrinfo-null-bytes.patch ----------(New B)---------- New: chunk-size (bsc#1288328) CVE-2026-103995-validate-http.client-Content-Length-chunk-size.patch New: and port (bsc#1289106) CVE-2026-116566-getaddrinfo-null-bytes.patch ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python311.spec ++++++ --- /var/tmp/diff_new_pack.VpBlGt/_old 2026-11-25 16:12:45.973901706 +0100 +++ /var/tmp/diff_new_pack.VpBlGt/_new 2026-11-25 16:12:45.975901791 +0100 @@ -206,6 +206,12 @@ # PATCH-FIX-UPSTREAM bsc1263083-http-cookies-atob-utf8.patch bsc#1263083 [email protected] # Use decodeURIComponent() for UTF-8 support in js_output() Patch58: bsc1263083-http-cookies-atob-utf8.patch +# PATCH-FIX-UPSTREAM CVE-2026-116566-getaddrinfo-null-bytes.patch bsc#1289106 [email protected] +# Reject null bytes in socket.getaddrinfo() host and port +Patch59: CVE-2026-116566-getaddrinfo-null-bytes.patch +# PATCH-FIX-UPSTREAM CVE-2026-103995-validate-http.client-Content-Length-chunk-size.patch bsc#1288328 [email protected] +# Validate http.client Content-Length and chunk-size +Patch60: CVE-2026-103995-validate-http.client-Content-Length-chunk-size.patch ### END OF PATCHES BuildRequires: autoconf-archive BuildRequires: automake ++++++ CVE-2026-103995-validate-http.client-Content-Length-chunk-size.patch ++++++ >From 1627e76e9227957565c1e95b3ca54de7f96bb38a Mon Sep 17 00:00:00 2001 From: metsw24-max <[email protected]> Date: Thu, 8 Oct 2026 18:10:51 +0530 Subject: [PATCH] gh-150751: validate http.client Content-Length and chunk-size (GH-150752) (GH-160771) 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. (cherry picked from commit 2eb2af805c156ca52b316bb4ced5e0ab3971d0ae) Also includes gh-159156 (ignore optional whitespace around Content-Length). Co-authored-by: metsw24-max <[email protected]> Co-authored-by: blago1 <[email protected]> --- Index: Python-3.11.18/Lib/http/client.py =================================================================== --- Python-3.11.18.orig/Lib/http/client.py 2026-11-06 17:19:06.503346500 +0100 +++ Python-3.11.18/Lib/http/client.py 2026-11-23 12:24:30.049920714 +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'} @@ -377,14 +382,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 @@ -551,7 +554,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.11.18/Lib/test/test_httplib.py =================================================================== --- Python-3.11.18.orig/Lib/test/test_httplib.py 2026-11-06 17:19:08.406877268 +0100 +++ Python-3.11.18/Lib/test/test_httplib.py 2026-11-23 12:24:30.052920746 +0100 @@ -1198,6 +1198,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.11.18/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.11.18/Misc/NEWS.d/next/Library/2026-06-02-13-10-00.gh-issue-150751.Hk2Vw9.rst 2026-11-23 12:24:30.054920768 +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 2cd10854b42f3ebe44072a501d06241fc250e161 Mon Sep 17 00:00:00 2001 From: Seth Larson <[email protected]> Date: Thu, 29 Oct 2026 12:15:29 -0500 Subject: [PATCH] [3.11] 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 | 30 +++++++++++++---- 4 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 Misc/NEWS.d/next/Security/2026-10-27-16-25-40.gh-issue-160898.epi53X.rst Index: Python-3.11.18/Doc/library/socket.rst =================================================================== --- Python-3.11.18.orig/Doc/library/socket.rst 2026-11-06 19:23:03.807233415 +0100 +++ Python-3.11.18/Doc/library/socket.rst 2026-11-20 15:36:37.121244248 +0100 @@ -859,6 +859,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. + .. function:: getfqdn([name]) Return a fully qualified domain name for *name*. If *name* is omitted or empty, Index: Python-3.11.18/Lib/test/test_socket.py =================================================================== --- Python-3.11.18.orig/Lib/test/test_socket.py 2026-11-06 17:19:09.095450259 +0100 +++ Python-3.11.18/Lib/test/test_socket.py 2026-11-20 15:36:37.129244388 +0100 @@ -1859,6 +1859,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.11.18/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.11.18/Misc/NEWS.d/next/Security/2026-10-27-16-25-40.gh-issue-160898.epi53X.rst 2026-11-20 15:36:37.131530688 +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.11.18/Modules/socketmodule.c =================================================================== --- Python-3.11.18.orig/Modules/socketmodule.c 2026-10-25 20:41:29.000000000 +0100 +++ Python-3.11.18/Modules/socketmodule.c 2026-11-20 15:38:02.175878013 +0100 @@ -6557,8 +6557,9 @@ struct addrinfo *res0 = NULL; PyObject *hobj = NULL; PyObject *pobj = (PyObject *)NULL; - char pbuf[30]; + 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; @@ -6579,31 +6580,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)) { - long value = PyLong_AsLong(pobj); - if (value == -1 && PyErr_Occurred()) + pstr = PyObject_Str(pobj); + if (pstr == NULL) + goto err; + assert(PyUnicode_Check(pstr)); + pptr = PyUnicode_AsUTF8AndSize(pstr, &plen); + if (pptr == NULL) goto err; - PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", value); - pptr = pbuf; } 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 @@ -6616,7 +6632,7 @@ if (PySys_Audit("socket.getaddrinfo", "OOiii", hobj, pobj, family, socktype, protocol) < 0) { - return NULL; + goto err; } memset(&hints, 0, sizeof(hints)); @@ -6657,12 +6673,14 @@ Py_DECREF(single); } Py_XDECREF(idna); + Py_XDECREF(pstr); if (res0) freeaddrinfo(res0); return all; err: Py_XDECREF(all); Py_XDECREF(idna); + Py_XDECREF(pstr); if (res0) freeaddrinfo(res0); return (PyObject *)NULL; ++++++ _scmsync.obsinfo ++++++ --- /var/tmp/diff_new_pack.VpBlGt/_old 2026-11-25 16:12:46.100907095 +0100 +++ /var/tmp/diff_new_pack.VpBlGt/_new 2026-11-25 16:12:46.103907222 +0100 @@ -1,6 +1,6 @@ -mtime: 1793228967 -commit: a15ef6f49974b8e225f80a8e3a98be959f5f43005299b4cdfc9dbed18b2fa379 +mtime: 1795433661 +commit: c22c9109afb7f443c87f90497818a5a0ed722a1f5c9cf866f2b94d43bdc89936 url: https://src.opensuse.org/python-interpreters/python311 -revision: a15ef6f49974b8e225f80a8e3a98be959f5f43005299b4cdfc9dbed18b2fa379 +revision: c22c9109afb7f443c87f90497818a5a0ed722a1f5c9cf866f2b94d43bdc89936 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 12:34:21.000000000 +0100 @@ -0,0 +1,7 @@ +_build.* +*.obscpio +*.osc +.osc +.pbuild +python311*-build/ +*.rej
