From 6d9d6457d8e4fa3c52f65fa6faa4e47e0b8674e3 Mon Sep 17 00:00:00 2001 From: user Date: Sun, 6 Oct 2024 12:27:55 +0400 Subject: [PATCH] Fix warning: 'tcp_handle_outgoing' accessing 16 bytes in a region of size 4 --- src/dnsredir.c | 6 +++--- src/dnsredir.h | 6 +++--- src/goodbyedpi.c | 8 ++++---- src/ttltrack.c | 12 ++++++------ src/ttltrack.h | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/dnsredir.c b/src/dnsredir.c index a63e074..ffd650c 100644 --- a/src/dnsredir.c +++ b/src/dnsredir.c @@ -197,8 +197,8 @@ int dns_is_dns_packet(const char *packet_data, const UINT packet_dataLen, const return FALSE; } -int dns_handle_outgoing(const uint32_t srcip[4], const uint16_t srcport, - const uint32_t dstip[4], const uint16_t dstport, +int dns_handle_outgoing(const uint32_t* srcip, const uint16_t srcport, + const uint32_t* dstip, const uint16_t dstport, const char *packet_data, const UINT packet_dataLen, const uint8_t is_ipv6) { @@ -216,7 +216,7 @@ int dns_handle_outgoing(const uint32_t srcip[4], const uint16_t srcport, return FALSE; } -int dns_handle_incoming(const uint32_t srcip[4], const uint16_t srcport, +int dns_handle_incoming(const uint32_t* srcip, const uint16_t srcport, const char *packet_data, const UINT packet_dataLen, conntrack_info_t *conn_info, const uint8_t is_ipv6) { diff --git a/src/dnsredir.h b/src/dnsredir.h index d5fed65..25e3033 100644 --- a/src/dnsredir.h +++ b/src/dnsredir.h @@ -24,12 +24,12 @@ inline static void ipv6_copy_addr(uint32_t dst[4], const uint32_t src[4]) { dst[3] = src[3]; } -int dns_handle_incoming(const uint32_t srcip[4], const uint16_t srcport, +int dns_handle_incoming(const uint32_t* srcip, const uint16_t srcport, const char *packet_data, const UINT packet_dataLen, conntrack_info_t *conn_info, const uint8_t is_ipv6); -int dns_handle_outgoing(const uint32_t srcip[4], const uint16_t srcport, - const uint32_t dstip[4], const uint16_t dstport, +int dns_handle_outgoing(const uint32_t* srcip, const uint16_t srcport, + const uint32_t* dstip, const uint16_t dstport, const char *packet_data, const UINT packet_dataLen, const uint8_t is_ipv6 ); diff --git a/src/goodbyedpi.c b/src/goodbyedpi.c index 2ec31a8..e4f0d24 100644 --- a/src/goodbyedpi.c +++ b/src/goodbyedpi.c @@ -1152,7 +1152,7 @@ int main(int argc, char *argv[]) { filter_num++; } - /* + /* * IPv4 & IPv6 filter for inbound HTTP redirection packets and * active DPI circumvention */ @@ -1294,7 +1294,7 @@ int main(int argc, char *argv[]) { } } /* Handle OUTBOUND packet on port 80, search for Host header */ - else if (addr.Outbound && + else if (addr.Outbound && packet_dataLen > 16 && (do_http_allports ? 1 : (ppTcpHdr->DstPort == htons(80))) && find_http_method_end(packet_data, @@ -1455,8 +1455,8 @@ int main(int argc, char *argv[]) { ppTcpHdr->SrcPort, ppTcpHdr->DstPort, 0, ppIpHdr->TTL)) || - (packet_v6 && tcp_handle_incoming((uint32_t*)&ppIpV6Hdr->SrcAddr, - (uint32_t*)&ppIpV6Hdr->DstAddr, + (packet_v6 && tcp_handle_incoming(ppIpV6Hdr->SrcAddr, + ppIpV6Hdr->DstAddr, ppTcpHdr->SrcPort, ppTcpHdr->DstPort, 1, ppIpV6Hdr->HopLimit)))) { diff --git a/src/ttltrack.c b/src/ttltrack.c index acac061..19bfd82 100644 --- a/src/ttltrack.c +++ b/src/ttltrack.c @@ -39,8 +39,8 @@ typedef struct tcp_connrecord { static time_t last_cleanup = 0; static tcp_connrecord_t *conntrack = NULL; -inline static void fill_key_data(char *key, const uint8_t is_ipv6, const uint32_t srcip[4], - const uint32_t dstip[4], const uint16_t srcport, const uint16_t dstport) +inline static void fill_key_data(char *key, const uint8_t is_ipv6, const uint32_t* srcip, + const uint32_t* dstip, const uint16_t srcport, const uint16_t dstport) { unsigned int offset = 0; @@ -94,7 +94,7 @@ inline static void fill_data_from_key(uint8_t *is_ipv6, uint32_t srcip[4], uint3 offset += sizeof(*dstport); } -inline static void construct_key(const uint32_t srcip[4], const uint32_t dstip[4], +inline static void construct_key(const uint32_t* srcip, const uint32_t* dstip, const uint16_t srcport, const uint16_t dstport, char *key, const uint8_t is_ipv6) { @@ -137,7 +137,7 @@ static int check_get_tcp_conntrack_key(const char *key, tcp_connrecord_t **connr return FALSE; } -static int add_tcp_conntrack(const uint32_t srcip[4], const uint32_t dstip[4], +static int add_tcp_conntrack(const uint32_t* srcip, const uint32_t* dstip, const uint16_t srcport, const uint16_t dstport, const uint8_t is_ipv6, const uint8_t ttl ) @@ -180,7 +180,7 @@ static void tcp_cleanup() { } } -int tcp_handle_incoming(uint32_t srcip[4], uint32_t dstip[4], +int tcp_handle_incoming(const uint32_t* srcip, const uint32_t* dstip, uint16_t srcport, uint16_t dstport, uint8_t is_ipv6, uint8_t ttl) { @@ -193,7 +193,7 @@ int tcp_handle_incoming(uint32_t srcip[4], uint32_t dstip[4], return FALSE; } -int tcp_handle_outgoing(uint32_t srcip[4], uint32_t dstip[4], +int tcp_handle_outgoing(const uint32_t* srcip, const uint32_t* dstip, uint16_t srcport, uint16_t dstport, tcp_conntrack_info_t *conn_info, uint8_t is_ipv6) diff --git a/src/ttltrack.h b/src/ttltrack.h index 2836a71..469324a 100644 --- a/src/ttltrack.h +++ b/src/ttltrack.h @@ -12,11 +12,11 @@ typedef struct tcp_conntrack_info { uint16_t dstport; } tcp_conntrack_info_t; -int tcp_handle_incoming(uint32_t srcip[4], uint32_t dstip[4], +int tcp_handle_incoming(const uint32_t* srcip, const uint32_t* dstip, uint16_t srcport, uint16_t dstport, uint8_t is_ipv6, uint8_t ttl); -int tcp_handle_outgoing(uint32_t srcip[4], uint32_t dstip[4], +int tcp_handle_outgoing(const uint32_t* srcip, const uint32_t* dstip, uint16_t srcport, uint16_t dstport, tcp_conntrack_info_t *conn_info, uint8_t is_ipv6);