-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-40645: restrict HMAC key len to INT_MAX #20238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Christian Heimes <[email protected]>
@@ -1403,6 +1403,12 @@ _hashlib_hmac_new_impl(PyObject *module, Py_buffer *key, PyObject *msg_obj, | |||
HMACobject *self = NULL; | |||
int r; | |||
|
|||
if (key->len > INT_MAX) { | |||
PyErr_SetString(PyExc_OverflowError, | |||
"key is too long."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"2 GB key should be enough for everyone" :-D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the fix.
Thanks @tiran for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9. |
GH-20245 is a backport of this pull request to the 3.9 branch. |
Signed-off-by: Christian Heimes <[email protected]> Automerge-Triggered-By: @tiran (cherry picked from commit aca4670) Co-authored-by: Christian Heimes <[email protected]>
Signed-off-by: Christian Heimes <[email protected]> Automerge-Triggered-By: @tiran (cherry picked from commit aca4670) Co-authored-by: Christian Heimes <[email protected]>
Signed-off-by: Christian Heimes <[email protected]> Automerge-Triggered-By: @tiran
Signed-off-by: Christian Heimes [email protected]
https://bugs.python.org/issue40645
Automerge-Triggered-By: @tiran