diff options
author | jbj <devnull@localhost> | 2000-12-12 21:05:49 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2000-12-12 21:05:49 +0000 |
commit | c7248553bebb427efa2ad1059ddd7c77b4d062d7 (patch) | |
tree | cfb81f2caefd877944c2ac082f3aa1812dd51fa9 /python | |
parent | db32ab6bea1b635129820d6b628e6156c61b5385 (diff) | |
download | rpm-c7248553bebb427efa2ad1059ddd7c77b4d062d7.tar.gz |
- fix: headerLoad segfault in python bindings.
CVS patchset: 4339
CVS date: 2000/12/12 21:05:49
Diffstat (limited to 'python')
-rw-r--r-- | python/rpmmodule.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/python/rpmmodule.c b/python/rpmmodule.c index 6db5448a1..83632d273 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -622,14 +622,22 @@ static PyObject * rpmHeaderFromFD(PyObject * self, PyObject * args) { static PyObject * hdrLoad(PyObject * self, PyObject * args) { - char * obj; + char * obj, * copy=NULL; Header hdr; hdrObject * h; int len; if (!PyArg_ParseTuple(args, "s#", &obj, &len)) return NULL; + + copy = malloc(len); + if (copy == NULL) { + PyErr_SetString(pyrpmError, "out of memory"); + return NULL; + } + + memcpy (copy, obj, len); - hdr = headerLoad(obj); + hdr = headerLoad(copy); if (!hdr) { PyErr_SetString(pyrpmError, "bad header"); return NULL; |