code review: fix handling of too long needles

This commit is contained in:
Raymond Hill 2018-11-19 14:04:26 -05:00
parent 13f2b6b86f
commit 2a91a685ce
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 1 additions and 1 deletions

View File

@ -88,7 +88,7 @@ const hnTrieManager = {
if ( needle !== this.needle ) {
const buf = this.trie;
let i = needle.length;
if ( i > 255 ) { i = 255; }
if ( i > 254 ) { i = 254; }
buf[255] = i;
while ( i-- ) {
buf[i] = needle.charCodeAt(i);