Skip to content

Commit 4d1d0dd

Browse files
cosmo0920edsiper
authored andcommitted
filter_geoip2: allow nested lookup paths beyond depth 2
geoip2 filter limited lookup path splitting to depth 2, which caused nested paths like 'subdivisions.0.names.en' to be truncated and fail at runtime. This change allows unlimited nesting by using flb_utils_split(..., 4), making array-backed fields such as subdivisions accessible. So, we need to accept subdivitions elements. For example, the following configuration could be broken on loading because of containing three dots or more. Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent f58598e commit 4d1d0dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugins/filter_geoip2/geoip2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ static void add_geoip_fields(msgpack_object *map,
240240
pos = strstr(record->val, "}");
241241
memset(key, '\0', sizeof(key));
242242
strncpy(key, record->val + 2, pos - (record->val + 2));
243-
split = flb_utils_split(key, '.', 2);
243+
split = flb_utils_split(key, '.', 8);
244244
split_size = mk_list_size(split);
245245
path = flb_malloc(sizeof(char *) * (split_size + 1));
246246
i = 0;

0 commit comments

Comments
 (0)