https://github.com/unbit/uwsgi/commit/c8c4bd1b5439217f2cb2f146caf162de69638bc1 From c8c4bd1b5439217f2cb2f146caf162de69638bc1 Mon Sep 17 00:00:00 2001 From: Cyrille Pontvieux Date: Thu, 1 Jul 2021 12:45:29 +0200 Subject: [PATCH] Allow to compile on Python versions with more that two digits (Python 3.10) --- plugins/python/pyloader.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/python/pyloader.c b/plugins/python/pyloader.c index d8ab6fe35..3a1465d67 100644 --- a/plugins/python/pyloader.c +++ b/plugins/python/pyloader.c @@ -22,7 +22,7 @@ PyMethodDef uwsgi_eventfd_write_method[] = { {"uwsgi_eventfd_write", py_eventfd_ void set_dyn_pyhome(char *home, uint16_t pyhome_len) { - char venv_version[15]; + char venv_version[30]; PyObject *site_module; PyObject *pysys_dict = get_uwsgi_pydict("sys"); @@ -45,8 +45,8 @@ void set_dyn_pyhome(char *home, uint16_t pyhome_len) { PyDict_SetItemString(pysys_dict, "prefix", venv_path); PyDict_SetItemString(pysys_dict, "exec_prefix", venv_path); - venv_version[14] = 0; - if (snprintf(venv_version, 15, "/lib/python%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION) == -1) { + bzero(venv_version, 30); + if (snprintf(venv_version, 30, "/lib/python%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION) == -1) { return; }