diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-01-28 17:07:42 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-01-28 17:07:42 +0200 |
commit | 06a2f1269b035a3a76464149834f2a5a8c4e89f2 (patch) | |
tree | d5d11a7900d974196484e2ad984321a8e6d47298 /python | |
parent | 5e4fb2589ca19b7844f420affe9977c04a124469 (diff) | |
download | rpm-06a2f1269b035a3a76464149834f2a5a8c4e89f2.tar.gz rpm-06a2f1269b035a3a76464149834f2a5a8c4e89f2.tar.bz2 rpm-06a2f1269b035a3a76464149834f2a5a8c4e89f2.zip |
Don't assume rpmfiNew() always succeeds
- Add NULL checks and add/adjust comments where appropriate.
- The remaining callers should handle NULL fi gracefully if not
entirely correctly: rpmfiFC() returns 0 on NULL fi, so these
callers just see the erronous file info set as "no files" case.
Something to fine-tune later...
Diffstat (limited to 'python')
-rw-r--r-- | python/rpmfi-py.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c index 4bfcc81e2..458e721b7 100644 --- a/python/rpmfi-py.c +++ b/python/rpmfi-py.c @@ -307,6 +307,11 @@ static PyObject * rpmfi_new(PyTypeObject * subtype, PyObject *args, PyObject *kw fi = rpmfiNew(NULL, h, tagN, flags); + if (fi == NULL) { + PyErr_SetString(PyExc_ValueError, "invalid file data in header"); + return NULL; + } + return rpmfi_Wrap(subtype, fi); } |