From: Eric Leblond Date: Tue, 6 May 2025 16:17:08 +0000 (+0200) Subject: datasets: fix set with ip sets X-Git-Tag: suricata-7.0.11~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ef11ae0222bd812a26f087836079d512720a15b;p=thirdparty%2Fsuricata.git datasets: fix set with ip sets It can get an IPv6 or an IPv4 so we need to handle both length. Ticket: #7689 (cherry picked from commit e499a98ba995ac25b40c5957faeff11c88410e93) --- diff --git a/src/datasets.c b/src/datasets.c index db9da76680..e82bed27ad 100644 --- a/src/datasets.c +++ b/src/datasets.c @@ -1502,12 +1502,12 @@ static int DatasetAddIPv6(Dataset *set, const uint8_t *data, const uint32_t data return -1; } - if (data_len != 16) { + if (data_len != 16 && data_len != 4) { return -2; } IPv6Type lookup = { .rep.value = 0 }; - memcpy(lookup.ipv6, data, 16); + memcpy(lookup.ipv6, data, data_len); struct THashDataGetResult res = THashGetFromHash(set->hash, &lookup); if (res.data) { DatasetUnlockData(res.data);