diff options
author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2021-11-10 18:46:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-10 18:46:11 (GMT) |
commit | c1323d4b8cb010a06c11bace6e681bea7f895851 (patch) | |
tree | 37800fb4b11f3dddef2f3c337fbf0deb98884d69 /Modules | |
parent | 4cdeee5978ee3f8ea7fe95172ae04d866cd88177 (diff) | |
download | cpython-c1323d4b8cb010a06c11bace6e681bea7f895851.zip cpython-c1323d4b8cb010a06c11bace6e681bea7f895851.tar.gz cpython-c1323d4b8cb010a06c11bace6e681bea7f895851.tar.bz2 |
bpo-45754: Use correct SQLite limit when checking statement length (GH-29489)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_sqlite/cursor.c | 4 | ||||
-rw-r--r-- | Modules/_sqlite/statement.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index 1d7c0b4..3ee1c5d 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -729,8 +729,8 @@ pysqlite_cursor_executescript_impl(pysqlite_Cursor *self, size_t sql_len = strlen(sql_script); int max_length = sqlite3_limit(self->connection->db, - SQLITE_LIMIT_LENGTH, -1); - if (sql_len >= (unsigned)max_length) { + SQLITE_LIMIT_SQL_LENGTH, -1); + if (sql_len > (unsigned)max_length) { PyErr_SetString(self->connection->DataError, "query string is too large"); return NULL; diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c index b20c91d..66fadb6 100644 --- a/Modules/_sqlite/statement.c +++ b/Modules/_sqlite/statement.c @@ -60,8 +60,8 @@ pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql) } sqlite3 *db = connection->db; - int max_length = sqlite3_limit(db, SQLITE_LIMIT_LENGTH, -1); - if (size >= max_length) { + int max_length = sqlite3_limit(db, SQLITE_LIMIT_SQL_LENGTH, -1); + if (size > max_length) { PyErr_SetString(connection->DataError, "query string is too large"); return NULL; |