Skip to content

Commit

Permalink
closes bpo-41235: Fix the error handling in SSLContext.load_dh_params…
Browse files Browse the repository at this point in the history
…() (pythonGH-21385)

(cherry picked from commit aebc049)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
  • Loading branch information
ZackerySpytz authored and miss-islington committed Jul 8, 2020
1 parent 730bce3 commit 79eed01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the error handling in :meth:`ssl.SSLContext.load_dh_params`.
6 changes: 4 additions & 2 deletions Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -4312,8 +4312,10 @@ _ssl__SSLContext_load_dh_params(PySSLContext *self, PyObject *filepath)
}
return NULL;
}
if (SSL_CTX_set_tmp_dh(self->ctx, dh) == 0)
_setSSLError(NULL, 0, __FILE__, __LINE__);
if (!SSL_CTX_set_tmp_dh(self->ctx, dh)) {
DH_free(dh);
return _setSSLError(NULL, 0, __FILE__, __LINE__);
}
DH_free(dh);
Py_RETURN_NONE;
}
Expand Down

0 comments on commit 79eed01

Please sign in to comment.