summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/statement.c
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2012-02-01 20:18:19 (GMT)
committerPetri Lehtinen <petri@digip.org>2012-02-01 20:18:35 (GMT)
commit023fe334bbb61fd4912dd6f3e02e19528333ac62 (patch)
treebcc9603314261713798c504f4043920c738926a4 /Modules/_sqlite/statement.c
parentfc3ba6b8fc0d9212cbae676a5c84847245767464 (diff)
downloadcpython-023fe334bbb61fd4912dd6f3e02e19528333ac62.zip
cpython-023fe334bbb61fd4912dd6f3e02e19528333ac62.tar.gz
cpython-023fe334bbb61fd4912dd6f3e02e19528333ac62.tar.bz2
sqlite3: Handle strings with embedded zeros correctly
Closes #13676.
Diffstat (limited to 'Modules/_sqlite/statement.c')
-rw-r--r--Modules/_sqlite/statement.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index f89fc9a..80bcc38 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -129,9 +129,9 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec
rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter));
break;
case TYPE_UNICODE:
- string = _PyUnicode_AsString(parameter);
+ string = _PyUnicode_AsStringAndSize(parameter, &buflen);
if (string != NULL)
- rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT);
+ rc = sqlite3_bind_text(self->st, pos, string, buflen, SQLITE_TRANSIENT);
else
rc = -1;
break;