diff Modules/_sqlite/statement.c @ 61720:7ba851d1b46e

Issue #6697: Check that _PyUnicode_AsString() result is not NULL in _sqlite Strip also some trailing spaces
author Victor Stinner <victor.stinner@haypocalc.com>
date Wed, 19 May 2010 01:27:23 +0000
parents 3003c1656e2a
children e9cd15d539e1
line wrap: on
line diff
--- a/Modules/_sqlite/statement.c	Wed May 19 01:17:01 2010 +0000
+++ b/Modules/_sqlite/statement.c	Wed May 19 01:27:23 2010 +0000
@@ -130,7 +130,10 @@
             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) {