bpo-45754: Use correct SQLite limit when checking statement length (GH-29489)

This commit is contained in:
Erlend Egeberg Aasland 2021-11-10 19:46:11 +01:00 committed by GitHub
parent 4cdeee5978
commit c1323d4b8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 11 deletions

View file

@ -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;

View file

@ -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;