diff options
author | Graham Dumpleton <Graham.Dumpleton@gmail.com> | 2022-05-25 16:36:12 +1000 |
---|---|---|
committer | Graham Dumpleton <Graham.Dumpleton@gmail.com> | 2022-05-25 16:36:12 +1000 |
commit | b88a94ad80771522f85f78909131cc78fea36993 (patch) | |
tree | c82f6fb2c36f0c2be37187c19d1f87d3ed798362 /src/server | |
parent | e82960b358c4697a100cf925d6819d437a1cf615 (diff) | |
download | mod_wsgi-b88a94ad80771522f85f78909131cc78fea36993.tar.gz |
Fix bug where daemon mode process could crash if invalid URL path was used.
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/mod_wsgi.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/server/mod_wsgi.c b/src/server/mod_wsgi.c index 59aad90..0123472 100644 --- a/src/server/mod_wsgi.c +++ b/src/server/mod_wsgi.c @@ -3852,9 +3852,20 @@ static int wsgi_reload_required(apr_pool_t *pool, request_rec *r, if (object) { PyObject *args = NULL; PyObject *result = NULL; +#if PY_MAJOR_VERSION >= 3 + PyObject *path = NULL; +#endif Py_INCREF(object); +#if PY_MAJOR_VERSION >= 3 + path = PyUnicode_Decode(resource, strlen(resource), + Py_FileSystemDefaultEncoding, + "surrogateescape"); + args = Py_BuildValue("(O)", path); + Py_DECREF(path); +#else args = Py_BuildValue("(s)", resource); +#endif result = PyObject_CallObject(object, args); Py_DECREF(args); Py_DECREF(object); |