From fbf8b2458c6ae3ad2ed2bf0575b94800722d5a04 Mon Sep 17 00:00:00 2001 From: Michael Budde Date: Sat, 16 Feb 2019 21:24:44 +0100 Subject: Fix tag value parsing If a tag is more than 2 characters from the beginning of the comment the tag value offset will be wrong. #1702 gives an example where the tag line starts with `;;` and the tag value thus becomes `: Bar` because of this bug. The use `index` in the offset calulation seems to be a lucky coincidence that works in the common case: "; tag: value" Fixes #1702 --- src/item.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/item.cc') diff --git a/src/item.cc b/src/item.cc index 7132103e..d46fba8b 100644 --- a/src/item.cc +++ b/src/item.cc @@ -198,7 +198,7 @@ void item_t::parse_tags(const char * p, tag = string(q, len - index); string_map::iterator i; - string field(p + len + index); + string field(p + (q - buf.get()) + len); trim(field); if (by_value) { bind_scope_t bound_scope(scope, *this); -- cgit v1.2.3