------------------------------------------------------------ revno: 13740 revision-id: squid3@treenet.co.nz-20150124045512-be74qtsnb26e9aal parent: squid3@treenet.co.nz-20150124045339-93hdn1m1554zjhb2 committer: Amos Jeffries branch nick: 3.5 timestamp: Fri 2015-01-23 20:55:12 -0800 message: Fix ::Parser::Tokenizer::prefix() limited token results When he prefix() method is passed a set limit for characters to scan and the matched characters do reach that limit the entire Tokenizer buffer content is consumed and returned. Correct operation is to only consume and return the matched characters. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20150124045512-be74qtsnb26e9aal # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # testament_sha1: a35942b9d22be8efa5e4184304b8f9171d4378e1 # timestamp: 2015-01-24 05:01:24 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # base_revision_id: squid3@treenet.co.nz-20150124045339-\ # 93hdn1m1554zjhb2 # # Begin patch === modified file 'src/parser/Tokenizer.cc' --- src/parser/Tokenizer.cc 2015-01-13 09:13:49 +0000 +++ src/parser/Tokenizer.cc 2015-01-24 04:55:12 +0000 @@ -71,11 +71,13 @@ bool Parser::Tokenizer::prefix(SBuf &returnedToken, const CharacterSet &tokenChars, const SBuf::size_type limit) { - const SBuf::size_type prefixLen = buf_.substr(0,limit).findFirstNotOf(tokenChars); + SBuf::size_type prefixLen = buf_.substr(0,limit).findFirstNotOf(tokenChars); if (prefixLen == 0) return false; if (prefixLen == SBuf::npos && (atEnd() || limit == 0)) return false; + if (prefixLen == SBuf::npos && limit > 0) + prefixLen = limit; returnedToken = consume(prefixLen); // cannot be empty after the npos check return true; }