Skip to content

Commit 0e00eb0

Browse files
JeffLuooedsiper
authored andcommitted
out_stackdriver: add prefix check to tag matching with regex
Signed-off-by: Jeff Luo <[email protected]>
1 parent 19a0c03 commit 0e00eb0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugins/out_stackdriver/stackdriver.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,9 +812,13 @@ static int is_tag_match_regex(struct flb_stackdriver *ctx,
812812
const char *tag_str_to_be_matcheds;
813813

814814
tag_prefix_len = flb_sds_len(ctx->tag_prefix);
815+
if (tag_len > tag_prefix_len &&
816+
flb_sds_cmp(ctx->tag_prefix, tag, tag_prefix_len) != 0) {
817+
return 0;
818+
}
819+
815820
tag_str_to_be_matcheds = tag + tag_prefix_len;
816821
len_to_be_matched = tag_len - tag_prefix_len;
817-
818822
ret = flb_regex_match(ctx->regex,
819823
(unsigned char *) tag_str_to_be_matcheds,
820824
len_to_be_matched);

0 commit comments

Comments
 (0)