mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-12 07:10:33 +03:00
Fix off-by-one error in PyMem_Malloc() call in
psyco_conn_set_client_encoding(). Fixes #211
This commit is contained in:
parent
6c2e3ab49b
commit
b5f4a5f6c2
|
@ -195,7 +195,7 @@ psyco_conn_set_client_encoding(connectionObject *self, PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "s", &enc)) return NULL;
|
if (!PyArg_ParseTuple(args, "s", &enc)) return NULL;
|
||||||
|
|
||||||
/* convert to upper case and remove '-' and '_' from string */
|
/* convert to upper case and remove '-' and '_' from string */
|
||||||
buffer = PyMem_Malloc(strlen(enc));
|
buffer = PyMem_Malloc(strlen(enc)+1);
|
||||||
for (i=j=0 ; i < strlen(enc) ; i++) {
|
for (i=j=0 ; i < strlen(enc) ; i++) {
|
||||||
if (enc[i] == '_' || enc[i] == '-')
|
if (enc[i] == '_' || enc[i] == '-')
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user