diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-11 10:29:05 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-11 10:29:05 (GMT) |
commit | 42d67af87fc2b1d297cce1cd8d762461e009f0a0 (patch) | |
tree | e9ad2265f9dc6bd1f5aee05f8bc64b0d45a4d3fd /Modules/_sqlite/statement.c | |
parent | abf68ce16474a2d252723099f1c7a6d640191123 (diff) | |
download | cpython-42d67af87fc2b1d297cce1cd8d762461e009f0a0.zip cpython-42d67af87fc2b1d297cce1cd8d762461e009f0a0.tar.gz cpython-42d67af87fc2b1d297cce1cd8d762461e009f0a0.tar.bz2 |
Issue #21147: sqlite3 now raises an exception if the request contains a null
character instead of truncate it. Based on patch by Victor Stinner.
Diffstat (limited to 'Modules/_sqlite/statement.c')
-rw-r--r-- | Modules/_sqlite/statement.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c index 66b4a52..34babfd 100644 --- a/Modules/_sqlite/statement.c +++ b/Modules/_sqlite/statement.c @@ -63,6 +63,10 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con rc = PYSQLITE_SQL_WRONG_TYPE; return rc; } + if (strlen(sql_cstr) != (size_t)sql_cstr_len) { + PyErr_SetString(PyExc_ValueError, "the query contains a null character"); + return PYSQLITE_SQL_WRONG_TYPE; + } self->in_weakreflist = NULL; Py_INCREF(sql); |