From 39c17da794b2a985e31ecaf3cfc6d346f46b590d Mon Sep 17 00:00:00 2001 From: adfnekc Date: Thu, 14 Apr 2022 12:13:06 +0800 Subject: [PATCH 1/2] fix udp payload data messy probelem --- src/templ-pkt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/templ-pkt.c b/src/templ-pkt.c index 1f11b6ee..6f9e0d7a 100644 --- a/src/templ-pkt.c +++ b/src/templ-pkt.c @@ -357,9 +357,9 @@ struct TemplateSet templ_copy(const struct TemplateSet *templset) for (i=0; icount; i++) { const struct TemplatePacket *p1 = &templset->pkts[i]; struct TemplatePacket *p2 = &result.pkts[i]; - p2->ipv4.packet = MALLOC(p2->ipv4.length); + p2->ipv4.packet = MALLOC(2048+p2->ipv4.length); memcpy(p2->ipv4.packet, p1->ipv4.packet, p2->ipv4.length); - p2->ipv6.packet = MALLOC(p2->ipv6.length); + p2->ipv6.packet = MALLOC(2048+p2->ipv6.length); memcpy(p2->ipv6.packet, p1->ipv6.packet, p2->ipv6.length); } From aabbb2691faed3d002e7d1b265cf7def46dce16d Mon Sep 17 00:00:00 2001 From: adfnekc Date: Fri, 15 Apr 2022 20:28:17 +0800 Subject: [PATCH 2/2] fix payloads_datagram_add add err when p->port == payloads->list[j]->port --- src/templ-payloads.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/templ-payloads.c b/src/templ-payloads.c index 0ecbdb33..22cfbe31 100644 --- a/src/templ-payloads.c +++ b/src/templ-payloads.c @@ -538,6 +538,7 @@ payloads_datagram_add(struct PayloadsUDP *payloads, payloads->list[j] = p; payloads->count += count; + count = 1; } } return count; /* zero or one */