From 637883dd90e10b05a27f55dfbffa83f746f0918e Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Wed, 5 Aug 2026 21:52:01 +0200 Subject: [PATCH] filter_geoip2: fix lookup key comparison This patch fixes the problem that when a key with the same prefix as the lookup key existed, the filter could choose the wrong one, as the comparison was limited to the length of the specified lookup key. Signed-off-by: Simon Bruder --- plugins/filter_geoip2/geoip2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/filter_geoip2/geoip2.c b/plugins/filter_geoip2/geoip2.c index fd20782124c..d86bd539c5c 100644 --- a/plugins/filter_geoip2/geoip2.c +++ b/plugins/filter_geoip2/geoip2.c @@ -165,8 +165,7 @@ static struct flb_hash_table *prepare_lookup_keys(msgpack_object *map, } flb_config_map_foreach(head, lookup_key, ctx->lookup_keys) { - if (strncasecmp(key->via.str.ptr, lookup_key->val.str, - flb_sds_len(lookup_key->val.str)) == 0) { + if (flb_sds_casecmp(lookup_key->val.str, key->via.str.ptr, key->via.str.size) == 0) { flb_hash_table_add(ht, lookup_key->val.str, flb_sds_len(lookup_key->val.str), (void *) val->via.str.ptr, val->via.str.size); }