Skip to content

Commit 721b245

Browse files
authored
Merge pull request #308 Fix build warning due to string truncation from stauffer-garmin/master
2 parents 3e35404 + 0ae04a6 commit 721b245

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Database.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ Header Database::getHeaderInfo(const std::string& aFilename)
310310
}
311311

312312
// If the "magic string" can't be found then header is invalid, corrupt or unreadable
313-
strncpy(pHeaderStr, pBuf, 16);
313+
memcpy(pHeaderStr, pBuf, 16);
314+
pHeaderStr[15] = '\0';
314315
if (strncmp(pHeaderStr, "SQLite format 3", 15) != 0)
315316
{
316317
throw SQLite::Exception("Invalid or encrypted SQLite header in file " + aFilename);

0 commit comments

Comments
 (0)