Compare 16bytes of header text.

pull/1/head
Tatsuhiro Tsujikawa 2011-08-06 23:04:06 +09:00
parent 8f93855bbd
commit f6472abae8
1 changed files with 1 additions and 2 deletions

View File

@ -348,8 +348,7 @@ bool CookieStorage::load(const std::string& filename, time_t now)
headlen = fp.read(header, sizeof(header));
}
try {
if(headlen &&
std::string(&header[0], &header[headlen-1]) == "SQLite format 3") {
if(headlen == 16 && memcmp(header, "SQLite format 3\0", 16) == 0) {
#ifdef HAVE_SQLITE3
std::vector<Cookie> cookies;
try {