[Redirector] Optimize code

This commit is contained in:
Connection Refused
2021-10-04 18:47:17 +08:00
parent 9bd45ed39a
commit fe59ae7a9e
3 changed files with 3 additions and 3 deletions

View File

@@ -74,7 +74,7 @@ bool DNSHandler::IsDNS(PSOCKADDR_IN6 target)
void DNSHandler::CreateHandler(ENDPOINT_ID id, PSOCKADDR_IN6 target, const char* packet, int length, PNF_UDP_OPTIONS options)
{
SOCKADDR_IN6 remote;
auto buffer = new char[length]();
auto buffer = new char[length];
auto option = (PNF_UDP_OPTIONS)new char[sizeof(NF_UDP_OPTIONS) + options->optionsLength];
memcpy(&remote, target, sizeof(SOCKADDR_IN6));

View File

@@ -53,7 +53,7 @@ void ipSend(const char* buffer, int length, PNF_IP_PACKET_OPTIONS options)
return;
}
auto data = new BYTE[length]();
auto data = new BYTE[length];
memcpy(data, buffer, length);
{

View File

@@ -361,7 +361,7 @@ int SocksHelper::UDP::Send(PSOCKADDR_IN6 target, const char* buffer, int length)
return SOCKET_ERROR;
}
auto data = new char[3 + 1 + 16 + 2 + (ULONG64)length]();
auto data = new char[3 + 1 + 16 + 2 + (ULONG64)length];
data[3] = (target->sin6_family == AF_INET) ? 0x01 : 0x04;
if (target->sin6_family == AF_INET)