summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorWilliam M. Brack <wbrack@src.gnome.org>2007-08-30 00:17:46 +0000
committerWilliam M. Brack <wbrack@src.gnome.org>2007-08-30 00:17:46 +0000
commit66af4a39075ca4701ea6b24bfb378256d9a25f1e (patch)
treede227f49be73b2875b6431efd66f3548e0d01691 /python
parent2896318613d0fd5b0ea52d5f4478d7dae932984e (diff)
downloadlibxslt-66af4a39075ca4701ea6b24bfb378256d9a25f1e.tar.gz
libxslt-66af4a39075ca4701ea6b24bfb378256d9a25f1e.tar.bz2
libxslt-66af4a39075ca4701ea6b24bfb378256d9a25f1e.zip
applied patch from Daniel Gryniewicz to fix a segfault caused by a
* python/libxslt.c: applied patch from Daniel Gryniewicz to fix a segfault caused by a parameter array not being preset to zero. svn path=/trunk/; revision=1444
Diffstat (limited to 'python')
-rw-r--r--python/libxslt.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/python/libxslt.c b/python/libxslt.c
index 18193838..32bec4c6 100644
--- a/python/libxslt.c
+++ b/python/libxslt.c
@@ -1,5 +1,5 @@
/*
- libxslt.c: this modules implements the main part of the glue of the
+ libxslt.c: this module implements the main part of the glue of the
* libxslt library and the Python interpreter. It provides the
* entry points where an automatically generated stub is either
* unpractical or would not match cleanly the Python model.
@@ -740,7 +740,7 @@ libxslt_xsltApplyStylesheet(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *pyobj_doc;
PyObject *pyobj_params;
const char **params = NULL;
- int len = 0, i = 0, j;
+ int len = 0, i = 0, j, params_size;
PyObject *name;
PyObject *value;
@@ -752,13 +752,14 @@ libxslt_xsltApplyStylesheet(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
if (PyDict_Check(pyobj_params)) {
len = PyDict_Size(pyobj_params);
if (len > 0) {
- params = (const char **) xmlMalloc((len + 1) * 2 *
- sizeof(char *));
+ params_size = (len + 1) * 2 * sizeof(char *);
+ params = (const char **) xmlMalloc(params_size);
if (params == NULL) {
printf("libxslt_xsltApplyStylesheet: out of memory\n");
Py_INCREF(Py_None);
return(Py_None);
}
+ memset(params, 0, params_size);
j = 0;
while (PyDict_Next(pyobj_params, &i, &name, &value)) {
const char *tmp;
@@ -829,7 +830,7 @@ libxslt_xsltSaveResultToString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
if(!buffer || emitted < 0)
goto FAIL;
/* We haven't tested the aberrant case of a transformation that
- * renders to an empty string. For now we try to play it save.
+ * renders to an empty string. For now we try to play it safe.
*/
if(size)
{