Skip to content

Commit

Permalink
Merge pull request #308 Fix build warning due to string truncation fr…
Browse files Browse the repository at this point in the history
…om stauffer-garmin/master
  • Loading branch information
SRombauts authored Nov 18, 2020
2 parents 3e35404 + 0ae04a6 commit 721b245
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ Header Database::getHeaderInfo(const std::string& aFilename)
}

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

0 comments on commit 721b245

Please sign in to comment.