From f6472abae8b422eb55de3fabe30915458bf557be Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 6 Aug 2011 23:04:06 +0900 Subject: [PATCH] Compare 16bytes of header text. --- src/CookieStorage.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/CookieStorage.cc b/src/CookieStorage.cc index dde8d06a..fa1df6b5 100644 --- a/src/CookieStorage.cc +++ b/src/CookieStorage.cc @@ -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 cookies; try {