summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-01-04 18:59:14 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-01-04 18:59:14 (GMT)
commite827eb8bdc797d2a8c194e675bd300e97aee6166 (patch)
treeaee7f9186f9e20eab24c20dd2cd0ba01d4f874e2 /plugins
parentb9fe3a839e9212b809d64c11bf92b703adb18fb2 (diff)
Handled non null-terminated strings
Diffstat (limited to 'plugins')
-rw-r--r--plugins/pychrysalide/format/strsym.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/pychrysalide/format/strsym.c b/plugins/pychrysalide/format/strsym.c
index 30224f8..8c210a2 100644
--- a/plugins/pychrysalide/format/strsym.c
+++ b/plugins/pychrysalide/format/strsym.c
@@ -73,12 +73,13 @@ static PyObject *py_string_symbol_get_raw(PyObject *self, void *closure)
{
PyObject *result; /* Valeur à retourner */
GStrSymbol *symbol; /* Elément à consulter */
+ size_t len; /* Taille de la chaîne */
const char *data; /* Données à manipuler */
symbol = G_STR_SYMBOL(pygobject_get(self));
- data = g_string_symbol_get_raw(symbol);
+ data = g_string_symbol_get_raw(symbol, &len);
- result = PyBytes_FromString(data);
+ result = PyBytes_FromStringAndSize(data, len);
return result;
@@ -102,12 +103,13 @@ static PyObject *py_string_symbol_get_utf8(PyObject *self, void *closure)
{
PyObject *result; /* Valeur à retourner */
GStrSymbol *symbol; /* Elément à consulter */
+ size_t len; /* Taille de la chaîne */
const char *data; /* Données à manipuler */
symbol = G_STR_SYMBOL(pygobject_get(self));
- data = g_string_symbol_get_raw(symbol);
+ data = g_string_symbol_get_utf8(symbol, &len);
- result = PyUnicode_FromString(data);
+ result = PyUnicode_FromStringAndSize(data, len);
return result;