Fix SF #754870, SSL crash interpreter when remote side closes during connect

Also fix a memory leak.
This commit is contained in:
Neal Norwitz 2003-06-30 03:25:20 +00:00
parent b346096b65
commit a9002f824b
2 changed files with 39 additions and 2 deletions

View file

@ -110,7 +110,7 @@ PySSL_SetError(PySSLObject *obj, int ret)
{
unsigned long e = ERR_get_error();
if (e == 0) {
if (ret == 0) {
if (ret == 0 || !obj->Socket) {
p = PY_SSL_ERROR_EOF;
errstr = "EOF occurred in violation of protocol";
} else if (ret == -1) {
@ -432,6 +432,7 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
timedout = wait_for_timeout(self->Socket, 0);
if (timedout) {
PyErr_SetString(PySSLErrorObject, "The read operation timed out");
Py_DECREF(buf);
return NULL;
}
do {