summaryrefslogtreecommitdiff
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2012-02-20 20:42:21 -0500
committerBarry Warsaw <barry@python.org>2012-02-20 20:42:21 -0500
commit1e13eb084f72d5993cbb726e45b36bdb69c83a24 (patch)
tree1db691c15c5980a870bcc2606a6d2afc77e28bad /Python/sysmodule.c
parentf5a5beb33985b4b55480de267084b90d89a5c5c4 (diff)
downloadcpython-git-1e13eb084f72d5993cbb726e45b36bdb69c83a24.tar.gz
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
environment variable, to provide an opt-in way to protect against denial of service attacks due to hash collisions within the dict and set types. Patch by David Malcolm, based on work by Victor Stinner.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 91fe224501..e73e5c283e 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1224,6 +1224,7 @@ static PyStructSequence_Field flags_fields[] = {
{"unicode", "-U"},
/* {"skip_first", "-x"}, */
{"bytes_warning", "-b"},
+ {"hash_randomization", "-R"},
{0}
};
@@ -1232,9 +1233,9 @@ static PyStructSequence_Desc flags_desc = {
flags__doc__, /* doc */
flags_fields, /* fields */
#ifdef RISCOS
- 16
+ 17
#else
- 15
+ 16
#endif
};
@@ -1271,6 +1272,7 @@ make_flags(void)
SetFlag(Py_UnicodeFlag);
/* SetFlag(skipfirstline); */
SetFlag(Py_BytesWarningFlag);
+ SetFlag(Py_HashRandomizationFlag);
#undef SetFlag
if (PyErr_Occurred()) {