Skip to content

Commit f12ed54

Browse files
committed
multiline: cri change strpbrk to memchr
Signed-off-by: ryanohnemus <[email protected]>
1 parent 9030e20 commit f12ed54

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/flb_parser_cri.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ int flb_parser_cri_do(struct flb_parser *parser,
5656
time_key_len = strlen(time_key);
5757

5858
/* Time */
59-
token_end = strchr(in_buf, CRI_SPACE_DELIM);
59+
token_end = memchr(in_buf, CRI_SPACE_DELIM, in_size);
6060

6161
/* after we find 'time' field (which is variable length),
6262
* we also check that we have enough room for static size fields
@@ -112,7 +112,10 @@ int flb_parser_cri_do(struct flb_parser *parser,
112112
token_end = token_end + 2; /* indicator + a space */
113113

114114
/* Log */
115-
end_of_line = strpbrk(token_end, "\r\n");
115+
end_of_line = memchr(token_end, '\n', token_end-in_buf);
116+
if (end_of_line == NULL) {
117+
end_of_line = memchr(token_end, '\r', token_end-in_buf);
118+
}
116119
if (end_of_line == NULL || end_of_line-token_end > in_size) {
117120
end_of_line = (char *)in_buf+in_size;
118121
}

0 commit comments

Comments
 (0)