coverity scan CID 22573: copy into fixed-size buffer

in theory, all IDs in the game should be no longer than 4 characters, but coverity doesn't know this.
This commit is contained in:
Enno Rehling 2015-10-29 09:15:29 +01:00
parent 78899ca801
commit 178a740ecf
1 changed files with 1 additions and 1 deletions

View File

@ -123,7 +123,7 @@ static void update_faction(sqlite3 *db, const faction *f) {
"INSERT INTO faction_data (faction_id, code, name, email, lang, turn)" "INSERT INTO faction_data (faction_id, code, name, email, lang, turn)"
" VALUES (?, ?, ?, ?, ?, ?)"; " VALUES (?, ?, ?, ?, ?, ?)";
sqlite3_stmt *stmt = 0; sqlite3_stmt *stmt = 0;
strcpy(code, itoa36(f->no)); strncpy(code, itoa36(f->no), sizeof(code));
sqlite3_prepare_v2(db, sql, -1, &stmt, 0); sqlite3_prepare_v2(db, sql, -1, &stmt, 0);
sqlite3_bind_int(stmt, 1, f->subscription); sqlite3_bind_int(stmt, 1, f->subscription);
sqlite3_bind_text(stmt, 2, code, -1, SQLITE_STATIC); sqlite3_bind_text(stmt, 2, code, -1, SQLITE_STATIC);