From 3ad151ae6c0d1c8158c2df9fd11fab0cd0075d6f Mon Sep 17 00:00:00 2001
From: Dan Kennedy <danielk1977@gmail.com>
Date: Mon, 7 Jan 2019 16:52:00 +0000
Subject: [PATCH 0721/1009] Fix another potential buffer overread in fts5.

https://github.com/mackyle/sqlite/commit/3ad151ae6c0d1c8158c2df9fd11fab0cd0075d6f

---
 ext/fts5/fts5_hash.c            |   3 +-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/ext/fts5/fts5_hash.c b/ext/fts5/fts5_hash.c
index 1757061..7e404a8 100644
--- a/ext/fts5/fts5_hash.c
+++ b/ext/fts5/fts5_hash.c
@@ -483,7 +483,8 @@ int sqlite3Fts5HashQuery(
 
   for(p=pHash->aSlot[iHash]; p; p=p->pHashNext){
     zKey = fts5EntryKey(p);
-    if( memcmp(zKey, pTerm, nTerm)==0 && zKey[nTerm]==0 ) break;
+    assert( p->nKey+1==(int)strlen(zKey) );
+    if( nTerm==p->nKey+1 && memcmp(zKey, pTerm, nTerm)==0 ) break;
   }
 
   if( p ){
-- 
1.8.3.1

