diff --git a/src/kernel/db/sqlite.c b/src/kernel/db/sqlite.c index e92f8cd57..6b88ad6c5 100644 --- a/src/kernel/db/sqlite.c +++ b/src/kernel/db/sqlite.c @@ -100,13 +100,20 @@ int db_driver_faction_save(dbrow_id * p_id, int no, const char *email, const cha { dbrow_id id = *p_id; int err; + char dbno[4]; + size_t len; + const char *str; sqlite3_stmt *stmt = (id > 0) ? g_stmt_update_faction : g_stmt_insert_faction; assert(g_game_db); err = sqlite3_reset(stmt); if (err != SQLITE_OK) return err; - err = sqlite3_bind_text(stmt, 1, itoa36(no), -1, SQLITE_STATIC); + str = itoa36(no); + len = strlen(str); + assert(len <= 4); + memcpy(dbno, str, len); + err = sqlite3_bind_text(stmt, 1, dbno, len, SQLITE_STATIC); if (err != SQLITE_OK) return err; err = sqlite3_bind_text(stmt, 2, email, -1, SQLITE_STATIC); if (err != SQLITE_OK) return err;