From d2309f003d91e8157ca1d36b3604526772abb5fa Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 12 Oct 2018 23:43:36 +0200 Subject: [PATCH] fix an off-by one, spotted by chance --- src/lib/symbol-impl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/symbol-impl.cpp b/src/lib/symbol-impl.cpp index a8c7676b9..066d16246 100644 --- a/src/lib/symbol-impl.cpp +++ b/src/lib/symbol-impl.cpp @@ -112,9 +112,9 @@ namespace lib { size_t hash=0; if (literal) { + size_t cnt = 1; const char *pos = literal; - size_t maxpos = STRING_MAX_RELEVANT; - for ( ; *pos && --maxpos; ++pos) + for ( ; cnt <= STRING_MAX_RELEVANT and *pos ; ++cnt, ++pos ) hash_combine(hash, *pos); }