The signature of sqlite3_prepare_v2 is as follows:
int sqlite3_prepare_v2(
sqlite3 *db, /* Database handle */
const char *zSql, /* SQL statement, UTF-8 encoded */
int nByte, /* Maximum length of zSql in bytes. */
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
const char **pzTail /* OUT: Pointer to unused portion of zSql */
);
Quoting from the SQLite docs[1]:
"If the caller knows that the supplied string is nul-terminated, then there is a small performance advantage to passing an nByte parameter that is the number of bytes in the input string including the nul-terminator."
sqlite3_prepare_v2 is used five places in the sqlite3 module. We can easily provide the string size in those places.
[1] https://sqlite.org/c3ref/prepare.html