1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2026-03-31 20:42:03 +03:00

Mayaqua/DNS: Fix memory safety in DNS operation threads

Fix #1329
This commit is contained in:
Yihong Wu
2021-12-12 17:00:03 +08:00
parent 2a40d21ef9
commit b91d9af5e3
3 changed files with 95 additions and 43 deletions

View File

@ -38,6 +38,7 @@ struct DNS_CACHE_REVERSE
struct DNS_RESOLVER
{
REF *Ref;
const char *Hostname;
LIST *IPList_v4;
LIST *IPList_v6;
@ -46,6 +47,7 @@ struct DNS_RESOLVER
struct DNS_RESOLVER_REVERSE
{
REF *Ref;
IP IP;
char *Hostname;
bool OK;
@ -69,7 +71,7 @@ DNS_CACHE_REVERSE *DnsCacheReverseFind(const IP *ip);
DNS_CACHE_REVERSE *DnsCacheReverseUpdate(const IP *ip, const char *hostname);
bool DnsResolve(IP *ipv6, IP *ipv4, const char *hostname, UINT timeout, volatile const bool *cancel_flag);
bool DnsResolveEx(LIST *iplist_v6, LIST *iplist_v4, const char *hostname, UINT timeout, volatile const bool *cancel_flag);
bool DnsResolveEx(LIST **iplist_v6, LIST **iplist_v4, const char *hostname, UINT timeout, volatile const bool *cancel_flag);
void DnsResolver(THREAD *t, void *param);
bool DnsResolveReverse(char *dst, const UINT size, const IP *ip, UINT timeout, volatile const bool *cancel_flag);
@ -77,4 +79,7 @@ void DnsResolverReverse(THREAD *t, void *param);
bool GetIPEx(IP *ip, const char *hostname, UINT timeout, volatile const bool *cancel_flag);
void ReleaseDnsResolver(DNS_RESOLVER *p);
void ReleaseDnsResolverReverse(DNS_RESOLVER_REVERSE *p);
#endif