CID 26252: Memory - illegal accesses (BUFFER_SIZE_WARNING)

Calling strncpy with a maximum size argument of 5 bytes on destination array "code" of size 5 bytes might leave the destination string unterminated.
This commit is contained in:
Enno Rehling 2015-10-29 16:51:39 +01:00
parent 1a252bc994
commit 3bf5ba14bb
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)"
" VALUES (?, ?, ?, ?, ?, ?)";
sqlite3_stmt *stmt = 0;
strncpy(code, itoa36(f->no), sizeof(code));
strncpy(code, itoa36(f->no), sizeof(code)-1);
sqlite3_prepare_v2(db, sql, -1, &stmt, 0);
sqlite3_bind_int(stmt, 1, f->subscription);
sqlite3_bind_text(stmt, 2, code, -1, SQLITE_STATIC);