Skip to content

Commit

Permalink
fix GetIPv4AddrInfo[Static]() with no/empty address string
Browse files Browse the repository at this point in the history
* looks, some systems return random value!
  directly return 0 in this case

Signed-off-by: hayati ayguen <[email protected]>
  • Loading branch information
hayguen committed May 13, 2018
1 parent a1036c1 commit 5a6c34b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/SimpleSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,8 @@ bool CSimpleSocket::EnableNagleAlgoritm()

uint32 CSimpleSocket::GetIPv4AddrInfoStatic( const char *pAddr, CSocketType nSocketType )
{
if (!pAddr || !pAddr[0])
return 0;
struct in_addr stIpAddress;
bool ret = GetAddrInfoStatic( pAddr, 0, &stIpAddress, nSocketType );
if (!ret)
Expand All @@ -1198,6 +1200,8 @@ uint32 CSimpleSocket::GetIPv4AddrInfoStatic( const char *pAddr, CSocketType nSoc

uint32 CSimpleSocket::GetIPv4AddrInfo( const char *pAddr )
{
if (!pAddr || !pAddr[0])
return 0;
struct in_addr stIpAddress;
bool ret = GetAddrInfo( pAddr, 0, &stIpAddress );
if (!ret)
Expand Down

0 comments on commit 5a6c34b

Please sign in to comment.