Skip to content

Commit 7222078

Browse files
committed
fix GetIPv4AddrInfo[Static]() with no/empty address string
* looks, some systems return random value! directly return 0 in this case Signed-off-by: hayati ayguen <[email protected]>
1 parent f011324 commit 7222078

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/SimpleSocket.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,8 @@ bool CSimpleSocket::EnableNagleAlgoritm()
11881188

11891189
uint32 CSimpleSocket::GetIPv4AddrInfoStatic( const char *pAddr, CSocketType nSocketType )
11901190
{
1191+
if (!pAddr || !pAddr[0])
1192+
return 0;
11911193
struct in_addr stIpAddress;
11921194
bool ret = GetAddrInfoStatic( pAddr, 0, &stIpAddress, nSocketType );
11931195
if (!ret)
@@ -1198,6 +1200,8 @@ uint32 CSimpleSocket::GetIPv4AddrInfoStatic( const char *pAddr, CSocketType nSoc
11981200

11991201
uint32 CSimpleSocket::GetIPv4AddrInfo( const char *pAddr )
12001202
{
1203+
if (!pAddr || !pAddr[0])
1204+
return 0;
12011205
struct in_addr stIpAddress;
12021206
bool ret = GetAddrInfo( pAddr, 0, &stIpAddress );
12031207
if (!ret)

0 commit comments

Comments
 (0)