summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/statement.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-05-19 01:27:23 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-05-19 01:27:23 (GMT)
commit8699950b04343afe37e9dcdce87028ba0f56827b (patch)
treeeae09cfadd1474a6cdb5a5b23f8d0bf03ae239c2 /Modules/_sqlite/statement.c
parentf6c578328c419f25dea91425479a6ceeb891b04d (diff)
downloadcpython-8699950b04343afe37e9dcdce87028ba0f56827b.zip
cpython-8699950b04343afe37e9dcdce87028ba0f56827b.tar.gz
cpython-8699950b04343afe37e9dcdce87028ba0f56827b.tar.bz2
Issue #6697: Check that _PyUnicode_AsString() result is not NULL in _sqlite
Strip also some trailing spaces
Diffstat (limited to 'Modules/_sqlite/statement.c')
-rw-r--r--Modules/_sqlite/statement.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index 48e039b..c040290 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -130,7 +130,10 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec
break;
case TYPE_UNICODE:
string = _PyUnicode_AsString(parameter);
- rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT);
+ if (string != NULL)
+ rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT);
+ else
+ rc = -1;
break;
case TYPE_BUFFER:
if (PyObject_AsCharBuffer(parameter, &buffer, &buflen) == 0) {