logfmt: don't omit last item if it does not have a value
A line like `foo=bar baz` should be parsed to `{"foo"=>"bar", "baz"=>nil}`, but `baz` was silently omitted by returning early from the parser.
@@ -98,9 +98,6 @@ static int logfmt_parser(struct flb_parser *parser,
while ((c < end) && ident_byte[*c]) {
c++;
}
- if (c == end) {
- break;
- }
key_len = c - key;
/* value */
@@ -108,7 +105,7 @@ static int logfmt_parser(struct flb_parser *parser,
value_str = FLB_FALSE;
value_escape = FLB_FALSE;
- if (*c == '=') {
+ if (c < end && *c == '=') {
c++;
if (c < end) {
if (*c == '"') {
