Menu

#1 getCiphers leaks strings

open
nobody
None
5
2003-07-22
2003-07-22
No

In version 0.7 POW.c, the ssl_object_get_ciphers C function that implements the python getCiphers function leaks all strings in the list and the list itself.

The fix is to always go through the path that does a "Py_DECREF(name);"

Here is a diff:

*** 3578,3584 ****
{
int inlist=0, i=0;
const char *cipher=NULL;
! PyObject *list=NULL, *name=NULL;

if (!PyArg_ParseTuple(args, ""))
goto error;
--- 3578,3584 ----
{
int inlist=0, i=0;
const char *cipher=NULL;
! PyObject *list=NULL, *name=NULL, *retList = NULL;

if (!PyArg_ParseTuple(args, ""))
goto error;
***************
*** 3597,3603 ****
goto error;
cipher = SSL_get_cipher_list(self->ssl, ++i);
}
! return Py_BuildValue("O", list);

error:

--- 3597,3603 ----
goto error;
cipher = SSL_get_cipher_list(self->ssl, ++i);
}
! retList = Py_BuildValue("O", list);

error:

***************
*** 3612,3618 ****
Py_DECREF(list);
}

! return NULL;
}

static char ssl_object_set_ciphers__doc__[] = "
--- 3612,3618 ----
Py_DECREF(list);
}

! return retList;
}

static char ssl_object_set_ciphers__doc__[] = "

Discussion


Log in to post a comment.