From 2a91a685ce3d2dae5d3c285cff1bc74a1982be74 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 19 Nov 2018 14:04:26 -0500 Subject: [PATCH] code review: fix handling of too long needles --- src/js/hntrie.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/hntrie.js b/src/js/hntrie.js index 0cf6b1da9..ad26faa28 100644 --- a/src/js/hntrie.js +++ b/src/js/hntrie.js @@ -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);