New submission from Yhojann Aguilera <[email protected]>:
The functios like as PyUnicode_FromString use a printf format in char array
argument. Example: PyUnicode_FromString("a%22b"); in module interprete the %22
as 22 blank spaces. A double quote in module add a backslash. Poc:
Y try send a string from c++ to python string using:
PyObject* pyString =
PyUnicode_FromString("/abc/def.html/a%22.php?abc=&def=%22;%00s%01");
....
PyObject* pyArgs = Py_BuildValue("(z)", pyString);
...
PyObject_CallObject(pFunc, pyArgs);
But in script the string is bad:
function(data):
print(data)
The result is:
/abc/def.html/a bogus %pp?abc=&def= %;(null)%
----------
components: Library (Lib)
messages: 328484
nosy: Yhojann Aguilera
priority: normal
severity: normal
status: open
title: Canot send real string from c api to module (corrupted string)
type: behavior
versions: Python 3.6
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35071>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com