aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python/src/Python/compile.c
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-06-13 19:29:50 +0300
committershadchin <shadchin@yandex-team.com>2024-06-13 19:51:47 +0300
commit9051e2318afc1bfbd88a103f7392e622aa8c9527 (patch)
tree5c63ea23ebd5e7b7b9864903a9312aa853193ca5 /contrib/tools/python/src/Python/compile.c
parent224da250178b9250c7577a167d44f94f732d3627 (diff)
downloadydb-9051e2318afc1bfbd88a103f7392e622aa8c9527.tar.gz
Update Python from 2.7.16 to 2.7.18
2a151e9cf2ebdfa59d250c1bbb800e908703a6f0
Diffstat (limited to 'contrib/tools/python/src/Python/compile.c')
-rw-r--r--contrib/tools/python/src/Python/compile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/tools/python/src/Python/compile.c b/contrib/tools/python/src/Python/compile.c
index 7f8babc12b..92b2c39b91 100644
--- a/contrib/tools/python/src/Python/compile.c
+++ b/contrib/tools/python/src/Python/compile.c
@@ -221,7 +221,7 @@ _Py_Mangle(PyObject *privateobj, PyObject *ident)
}
plen = strlen(p);
- if (plen + nlen >= PY_SSIZE_T_MAX - 1) {
+ if (nlen >= PY_SSIZE_T_MAX - 1 - plen) {
PyErr_SetString(PyExc_OverflowError,
"private identifier too large to be mangled");
return NULL;
@@ -233,7 +233,7 @@ _Py_Mangle(PyObject *privateobj, PyObject *ident)
/* ident = "_" + p[:plen] + name # i.e. 1+plen+nlen bytes */
buffer = PyString_AS_STRING(ident);
buffer[0] = '_';
- strncpy(buffer+1, p, plen);
+ memcpy(buffer+1, p, plen);
strcpy(buffer+1+plen, name);
return ident;
}