summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-06-26 12:11:54 +0200
committerNatalia <124304+nessita@users.noreply.github.com>2024-07-09 09:42:58 -0300
commite99ccc43429160828814a72067acf47f5fca9c94 (patch)
treef1db7e77c189de1ceb7e2202d6131bb9ce58643a /docs/ref
parent6d36203648a7e14abc89b9aeb8ae9678535b51fb (diff)
[5.1.x] Fixed CVE-2024-39614 -- Mitigated potential DoS in get_supported_language_variant().
Language codes are now parsed with a maximum length limit of 500 chars. Thanks to MProgrammer for the report.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/utils.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt
index 3e357cba17..a493ec9dbf 100644
--- a/docs/ref/utils.txt
+++ b/docs/ref/utils.txt
@@ -1107,6 +1107,11 @@ For a complete discussion on the usage of the following see the
``lang_code`` is ``'es-ar'`` and ``'es'`` is in :setting:`LANGUAGES` but
``'es-ar'`` isn't.
+ ``lang_code`` has a maximum accepted length of 500 characters. A
+ :exc:`ValueError` is raised if ``lang_code`` exceeds this limit and
+ ``strict`` is ``True``, or if there is no generic variant and ``strict``
+ is ``False``.
+
If ``strict`` is ``False`` (the default), a country-specific variant may
be returned when neither the language code nor its generic variant is found.
For example, if only ``'es-co'`` is in :setting:`LANGUAGES`, that's
@@ -1115,6 +1120,11 @@ For a complete discussion on the usage of the following see the
Raises :exc:`LookupError` if nothing is found.
+ .. versionchanged:: 4.2.14
+
+ In older versions, ``lang_code`` values over 500 characters were
+ processed without raising a :exc:`ValueError`.
+
.. function:: to_locale(language)
Turns a language name (en-us) into a locale name (en_US).