Use utf-8 decoding with surrogateescape for invalid utf-8 for env and hdr val

This commit is contained in:
Stuart D. Gathman
2020-04-23 15:52:20 -04:00
parent 805825438c
commit d5f9f86bba
2 changed files with 23 additions and 11 deletions
+1 -1
View File
@@ -643,7 +643,7 @@ generic_env_wrapper(SMFICTX *ctx, PyObject*cb, char **argv) {
/* There's some error checking performed in do_mkvalue() for a string */
/* that's not currently done here - it probably should be */
#if PY_MAJOR_VERSION >= 3
PyObject *o = PyUnicode_FromStringAndSize(argv[i], strlen(argv[i]));
PyObject *o = PyBytes_FromStringAndSize(argv[i], strlen(argv[i]));
#else
PyObject *o = PyString_FromStringAndSize(argv[i], strlen(argv[i]));
#endif