summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-02-18 21:15:26 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-02-18 21:15:26 (GMT)
commitcd6b1657ed58ddbb0e5d7f13c1428b19310b90bd (patch)
tree6916d51c62a1cbf7a762af32d2894a8756076917 /plugins/pychrysalide
parent838ed83634c445e4ba1b15998f4ad50d1e7503c9 (diff)
Parsed Python bytes-like objects arguments with care.
Diffstat (limited to 'plugins/pychrysalide')
-rw-r--r--plugins/pychrysalide/analysis/contents/memory.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/pychrysalide/analysis/contents/memory.c b/plugins/pychrysalide/analysis/contents/memory.c
index 02d5862..8926300 100644
--- a/plugins/pychrysalide/analysis/contents/memory.c
+++ b/plugins/pychrysalide/analysis/contents/memory.c
@@ -59,7 +59,7 @@ static PyObject *py_memory_content_new(PyTypeObject *type, PyObject *args, PyObj
{
PyObject *result; /* Instance à retourner */
const char *data; /* Tampon interne de Python */
- Py_ssize_t length; /* Taille utilisé de ce tampon */
+ int length; /* Taille utilisé de ce tampon */
int ret; /* Bilan de lecture des args. */
GBinContent *content; /* Version GLib du contenu */
@@ -74,6 +74,11 @@ static PyObject *py_memory_content_new(PyTypeObject *type, PyObject *args, PyObj
"Where data is provided as string or read-only bytes-like object." \
" The string may contain embedded null bytes."
+ /**
+ * La taille doit être de type 'int' et non 'Py_ssize_t', sinon les 32 bits
+ * de poids fort ne sont pas initialisés !
+ */
+
ret = PyArg_ParseTuple(args, "s#", &data, &length);
if (!ret) return NULL;