Compare commits

...

3 Commits

Author SHA1 Message Date
HiGarfield
6303ce2387
Merge ee1e4d33f8f01f8a53be3a726f922ad5eb6195aa into e42f0e573221c5e0146c02fd5d71f32aa93c7221 2023-11-16 00:48:31 -05:00
Yancey Wang
e42f0e5732
Update README.md 2023-11-15 15:15:46 -05:00
HiGarfield
ee1e4d33f8 fix possible null pointer dereference
cppcheck reports:
network.cpp:1717:22: error: Null pointer dereference: payload [ctunullpointer]
    memcpy(tcp_data, payload, payloadlen);
                     ^
client.cpp:193:22: note: Calling function send_raw0, 2nd argument is null
            send_raw0(raw_info, 0, 0);
                     ^
network.cpp:2534:20: note: Calling function send_raw_tcp, 2nd argument is null
            return send_raw_tcp(raw_info, payload, payloadlen);
                   ^
network.cpp:1717:22: note: Dereferencing argument payload that is null
    memcpy(tcp_data, payload, payloadlen);
                     ^
2023-10-08 11:37:35 +08:00
2 changed files with 3 additions and 2 deletions

View File

@ -81,7 +81,7 @@ Assume your UDP is blocked or being QOS-ed or just poorly supported. Assume your
Now,an encrypted raw tunnel has been established between client and server through TCP port 4096. Connecting to UDP port 3333 at the client side is equivalent to connecting to port 7777 at the server side. No UDP traffic will be exposed. Now,an encrypted raw tunnel has been established between client and server through TCP port 4096. Connecting to UDP port 3333 at the client side is equivalent to connecting to port 7777 at the server side. No UDP traffic will be exposed.
### Note ### Note
To run on Android, check [Android_Guide](/doc/android_guide.md) To run on Android, check [Android_Guide](https://github.com/wangyu-/udp2raw/wiki/Android-Guide)
`-a` option automatically adds an iptables rule (or a few iptables rules) for you, udp2raw relies on this iptables rule to work stably. Be aware you dont forget `-a` (its a common mistake). If you dont want udp2raw to add iptables rule automatically, you can add it manually(take a look at `-g` option) and omit `-a`. `-a` option automatically adds an iptables rule (or a few iptables rules) for you, udp2raw relies on this iptables rule to work stably. Be aware you dont forget `-a` (its a common mistake). If you dont want udp2raw to add iptables rule automatically, you can add it manually(take a look at `-g` option) and omit `-a`.

View File

@ -1714,7 +1714,8 @@ int send_raw_tcp(raw_info_t &raw_info, const char *payload, int payloadlen) { /
char *tcp_data = send_raw_tcp_buf + +tcph->doff * 4; char *tcp_data = send_raw_tcp_buf + +tcph->doff * 4;
memcpy(tcp_data, payload, payloadlen); if (payload)
memcpy(tcp_data, payload, payloadlen);
int tcp_totlen = tcph->doff * 4 + payloadlen; int tcp_totlen = tcph->doff * 4 + payloadlen;
if (raw_ip_version == AF_INET) { if (raw_ip_version == AF_INET) {