diff options
author | xuhy <huayong.xu@samsung.com> | 2023-11-16 17:39:20 +0800 |
---|---|---|
committer | xuhy <huayong.xu@samsung.com> | 2023-11-16 17:39:20 +0800 |
commit | 76ea0b5d4a1b8180f2552c2729d84388a77beecb (patch) | |
tree | 9a2b028c24c205b075d9386acd7a62a2eb2271a7 /python/rpmds-py.c | |
parent | c30d127e8780dc678168ee121b9f2eeb1a8aaafa (diff) | |
download | librpm-tizen-master.tar.gz librpm-tizen-master.tar.bz2 librpm-tizen-master.zip |
The following issues are fixed:
1. Prevent execution of arbitrary scripts
2. Enable dash(-) in spec file.
3. Ignore bad expressions in %if conditionals.
4. Ignore unknown tags.
5. Ignore error macro.
Change-Id: Id5b7b47c1a78de364ef0d513023fbe9ccc773a87
Signed-off-by: xuhy <huayong.xu@samsung.com>
Diffstat (limited to 'python/rpmds-py.c')
-rw-r--r-- | python/rpmds-py.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/python/rpmds-py.c b/python/rpmds-py.c index 9eae9a228..86d993f5b 100644 --- a/python/rpmds-py.c +++ b/python/rpmds-py.c @@ -31,19 +31,19 @@ rpmds_Ix(rpmdsObject * s) static PyObject * rpmds_DNEVR(rpmdsObject * s) { - return Py_BuildValue("s", rpmdsDNEVR(s->ds)); + return utf8FromString(rpmdsDNEVR(s->ds)); } static PyObject * rpmds_N(rpmdsObject * s) { - return Py_BuildValue("s", rpmdsN(s->ds)); + return utf8FromString(rpmdsN(s->ds)); } static PyObject * rpmds_EVR(rpmdsObject * s) { - return Py_BuildValue("s", rpmdsEVR(s->ds)); + return utf8FromString(rpmdsEVR(s->ds)); } static PyObject * @@ -230,14 +230,14 @@ rpmds_subscript(rpmdsObject * s, PyObject * key) { int ix; - if (!PyInt_Check(key)) { + if (!PyLong_Check(key)) { PyErr_SetString(PyExc_TypeError, "integer expected"); return NULL; } - ix = (int) PyInt_AsLong(key); + ix = (int) PyLong_AsLong(key); rpmdsSetIx(s->ds, ix); - return Py_BuildValue("s", rpmdsDNEVR(s->ds)); + return utf8FromString(rpmdsDNEVR(s->ds)); } static PyMappingMethods rpmds_as_mapping = { @@ -258,9 +258,9 @@ static int depflags(PyObject *o, rpmsenseFlags *senseFlags) PyObject *str = NULL; rpmsenseFlags flags = RPMSENSE_ANY; - if (PyInt_Check(o)) { + if (PyLong_Check(o)) { ok = 1; - flags = PyInt_AsLong(o); + flags = PyLong_AsLong(o); } else if (utf8FromPyObject(o, &str)) { ok = 1; for (const char *s = PyBytes_AsString(str); *s; s++) { @@ -339,7 +339,7 @@ static char rpmds_doc[] = PyTypeObject rpmds_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) - "rpm.ds", /* tp_name */ + PYTHON_MODULENAME".ds", /* tp_name */ sizeof(rpmdsObject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ |