From 178a740ecf087e52a15ae225690db721853e6b78 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 29 Oct 2015 09:15:29 +0100 Subject: [PATCH] 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. --- src/sqlite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sqlite.c b/src/sqlite.c index fd46c4f1f..64819bca1 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -123,7 +123,7 @@ static void update_faction(sqlite3 *db, const faction *f) { "INSERT INTO faction_data (faction_id, code, name, email, lang, turn)" " VALUES (?, ?, ?, ?, ?, ?)"; 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_bind_int(stmt, 1, f->subscription); sqlite3_bind_text(stmt, 2, code, -1, SQLITE_STATIC);