Fix warning: 'tcp_handle_outgoing' accessing 16 bytes in a region of 4 #688
+18
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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,
| ^~~~~~~~~~~~~~~~~~~