Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning: 'tcp_handle_outgoing' accessing 16 bytes in a region of 4 #688

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Decavoid
Copy link

@Decavoid Decavoid commented Oct 6, 2024

Fixed compilation warnings in functions tcp_handle_outgoing, tcp_handle_incoming, dns_handle_incoming, dns_handle_outgoing.

Details

goodbyedpi.c:104:23: warning: 'tcp_handle_outgoing' accessing 16 bytes in a region of size 4 [-Wstringop-overflow=]
104 | if ((packet_v4 && tcp_handle_outgoing(&ppIpHdr->SrcAddr, &ppIpHdr->DstAddr,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105 | ppTcpHdr->SrcPort, ppTcpHdr->DstPort,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106 | &tcp_conn_info, 0))
| ~~~~~~~~~~~~~~~~~~
goodbyedpi.c:115:9: note: in expansion of macro 'TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF'
115 | TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF() {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:1287:33: note: in expansion of macro 'TCP_HANDLE_OUTGOING_FAKE_PACKET'
1287 | TCP_HANDLE_OUTGOING_FAKE_PACKET(send_fake_https_request);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:104:23: note: referencing argument 1 of type 'uint32_t[4]' {aka 'unsigned int[4]'}
104 | if ((packet_v4 && tcp_handle_outgoing(&ppIpHdr->SrcAddr, &ppIpHdr->DstAddr,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105 | ppTcpHdr->SrcPort, ppTcpHdr->DstPort,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106 | &tcp_conn_info, 0))
| ~~~~~~~~~~~~~~~~~~
goodbyedpi.c:115:9: note: in expansion of macro 'TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF'
115 | TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF() {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:1287:33: note: in expansion of macro 'TCP_HANDLE_OUTGOING_FAKE_PACKET'
1287 | TCP_HANDLE_OUTGOING_FAKE_PACKET(send_fake_https_request);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:104:23: warning: 'tcp_handle_outgoing' accessing 16 bytes in a region of size 4 [-Wstringop-overflow=]
104 | if ((packet_v4 && tcp_handle_outgoing(&ppIpHdr->SrcAddr, &ppIpHdr->DstAddr,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105 | ppTcpHdr->SrcPort, ppTcpHdr->DstPort,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106 | &tcp_conn_info, 0))
| ~~~~~~~~~~~~~~~~~~
goodbyedpi.c:115:9: note: in expansion of macro 'TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF'
115 | TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF() {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:1287:33: note: in expansion of macro 'TCP_HANDLE_OUTGOING_FAKE_PACKET'
1287 | TCP_HANDLE_OUTGOING_FAKE_PACKET(send_fake_https_request);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:104:23: note: referencing argument 2 of type 'uint32_t[4]' {aka 'unsigned int[4]'}
104 | if ((packet_v4 && tcp_handle_outgoing(&ppIpHdr->SrcAddr, &ppIpHdr->DstAddr,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105 | ppTcpHdr->SrcPort, ppTcpHdr->DstPort,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106 | &tcp_conn_info, 0))
| ~~~~~~~~~~~~~~~~~~
goodbyedpi.c:115:9: note: in expansion of macro 'TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF'
115 | TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF() {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:1287:33: note: in expansion of macro 'TCP_HANDLE_OUTGOING_FAKE_PACKET'
1287 | TCP_HANDLE_OUTGOING_FAKE_PACKET(send_fake_https_request);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from goodbyedpi.c:20:
ttltrack.h:19:5: note: in a call to function 'tcp_handle_outgoing'
19 | int tcp_handle_outgoing(uint32_t srcip[4], uint32_t dstip[4],
| ^~~~~~~~~~~~~~~~~~~
goodbyedpi.c:104:23: warning: 'tcp_handle_outgoing' accessing 16 bytes in a region of size 4 [-Wstringop-overflow=]
104 | if ((packet_v4 && tcp_handle_outgoing(&ppIpHdr->SrcAddr, &ppIpHdr->DstAddr,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105 | ppTcpHdr->SrcPort, ppTcpHdr->DstPort,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106 | &tcp_conn_info, 0))
| ~~~~~~~~~~~~~~~~~~
goodbyedpi.c:115:9: note: in expansion of macro 'TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF'
115 | TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF() {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:1328:29: note: in expansion of macro 'TCP_HANDLE_OUTGOING_FAKE_PACKET'
1328 | TCP_HANDLE_OUTGOING_FAKE_PACKET(send_fake_http_request);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:104:23: note: referencing argument 1 of type 'uint32_t[4]' {aka 'unsigned int[4]'}
104 | if ((packet_v4 && tcp_handle_outgoing(&ppIpHdr->SrcAddr, &ppIpHdr->DstAddr,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105 | ppTcpHdr->SrcPort, ppTcpHdr->DstPort,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106 | &tcp_conn_info, 0))
| ~~~~~~~~~~~~~~~~~~
goodbyedpi.c:115:9: note: in expansion of macro 'TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF'
115 | TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF() {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:1328:29: note: in expansion of macro 'TCP_HANDLE_OUTGOING_FAKE_PACKET'
1328 | TCP_HANDLE_OUTGOING_FAKE_PACKET(send_fake_http_request);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:104:23: warning: 'tcp_handle_outgoing' accessing 16 bytes in a region of size 4 [-Wstringop-overflow=]
104 | if ((packet_v4 && tcp_handle_outgoing(&ppIpHdr->SrcAddr, &ppIpHdr->DstAddr,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105 | ppTcpHdr->SrcPort, ppTcpHdr->DstPort,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106 | &tcp_conn_info, 0))
| ~~~~~~~~~~~~~~~~~~
goodbyedpi.c:115:9: note: in expansion of macro 'TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF'
115 | TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF() {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:1328:29: note: in expansion of macro 'TCP_HANDLE_OUTGOING_FAKE_PACKET'
1328 | TCP_HANDLE_OUTGOING_FAKE_PACKET(send_fake_http_request);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:104:23: note: referencing argument 2 of type 'uint32_t[4]' {aka 'unsigned int[4]'}
104 | if ((packet_v4 && tcp_handle_outgoing(&ppIpHdr->SrcAddr, &ppIpHdr->DstAddr,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105 | ppTcpHdr->SrcPort, ppTcpHdr->DstPort,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106 | &tcp_conn_info, 0))
| ~~~~~~~~~~~~~~~~~~
goodbyedpi.c:115:9: note: in expansion of macro 'TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF'
115 | TCP_HANDLE_OUTGOING_TTL_PARSE_PACKET_IF() {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:1328:29: note: in expansion of macro 'TCP_HANDLE_OUTGOING_FAKE_PACKET'
1328 | TCP_HANDLE_OUTGOING_FAKE_PACKET(send_fake_http_request);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ttltrack.h:19:5: note: in a call to function 'tcp_handle_outgoing'
19 | int tcp_handle_outgoing(uint32_t srcip[4], uint32_t dstip[4],
| ^~~~~~~~~~~~~~~~~~~
goodbyedpi.c:1454:45: warning: 'tcp_handle_incoming' accessing 16 bytes in a region of size 4 [-Wstringop-overflow=]
1454 | if (!((packet_v4 && tcp_handle_incoming(&ppIpHdr->SrcAddr, &ppIpHdr->DstAddr,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1455 | ppTcpHdr->SrcPort, ppTcpHdr->DstPort,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1456 | 0, ppIpHdr->TTL))
| ~~~~~~~~~~~~~~~~
goodbyedpi.c:1454:45: note: referencing argument 1 of type 'uint32_t[4]' {aka 'unsigned int[4]'}
goodbyedpi.c:1454:45: warning: 'tcp_handle_incoming' accessing 16 bytes in a region of size 4 [-Wstringop-overflow=]
goodbyedpi.c:1454:45: note: referencing argument 2 of type 'uint32_t[4]' {aka 'unsigned int[4]'}
ttltrack.h:15:5: note: in a call to function 'tcp_handle_incoming'
15 | int tcp_handle_incoming(uint32_t srcip[4], uint32_t dstip[4],
| ^~~~~~~~~~~~~~~~~~~
goodbyedpi.c:1486:39: warning: 'dns_handle_incoming' reading 16 bytes from a region of size 4 [-Wstringop-overread]
1486 | if ((packet_v4 && dns_handle_incoming(&ppIpHdr->DstAddr, ppUdpHdr->DstPort,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1487 | packet_data, packet_dataLen,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1488 | &dns_conn_info, 0))
| ~~~~~~~~~~~~~~~~~~
goodbyedpi.c:1486:39: note: referencing argument 1 of type 'const uint32_t[4]' {aka 'const unsigned int[4]'}
In file included from goodbyedpi.c:19:
dnsredir.h:27:5: note: in a call to function 'dns_handle_incoming'
27 | int dns_handle_incoming(const uint32_t srcip[4], const uint16_t srcport,
| ^~~~~~~~~~~~~~~~~~~
goodbyedpi.c:1516:39: warning: 'dns_handle_outgoing' reading 16 bytes from a region of size 4 [-Wstringop-overread]
1516 | if ((packet_v4 && dns_handle_outgoing(&ppIpHdr->SrcAddr, ppUdpHdr->SrcPort,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1517 | &ppIpHdr->DstAddr, ppUdpHdr->DstPort,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1518 | packet_data, packet_dataLen, 0))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goodbyedpi.c:1516:39: note: referencing argument 1 of type 'const uint32_t[4]' {aka 'const unsigned int[4]'}
goodbyedpi.c:1516:39: warning: 'dns_handle_outgoing' reading 16 bytes from a region of size 4 [-Wstringop-overread]
goodbyedpi.c:1516:39: note: referencing argument 3 of type 'const uint32_t[4]' {aka 'const unsigned int[4]'}
dnsredir.h:31:5: note: in a call to function 'dns_handle_outgoing'
31 | int dns_handle_outgoing(const uint32_t srcip[4], const uint16_t srcport,
| ^~~~~~~~~~~~~~~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants