Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gframe/data_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ void DataManager::ReadStringConfLine(const char* linebuf) {
}
}
bool DataManager::Error(sqlite3* pDB, sqlite3_stmt* pStmt) {
errmsg[0] = '\0';
std::strncat(errmsg, sqlite3_errmsg(pDB), sizeof errmsg - 1);
std::strncpy(errmsg, sqlite3_errmsg(pDB), sizeof errmsg - 1);
errmsg[sizeof errmsg - 1] = 0;
Comment on lines +168 to +169

Copilot AI Jun 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using a safer string copy approach such as std::snprintf (if available) or a dedicated safe string copy utility to reduce the risk of truncation issues, even though the manual null-termination is handled on the next line.

Suggested change
std::strncpy(errmsg, sqlite3_errmsg(pDB), sizeof errmsg - 1);
errmsg[sizeof errmsg - 1] = 0;
std::snprintf(errmsg, sizeof errmsg, "%s", sqlite3_errmsg(pDB));

Copilot uses AI. Check for mistakes.
if(pStmt)
sqlite3_finalize(pStmt);
return false;
Expand Down