From 5a6c34bb1a34fdc4a8fc49d6059a43ce497b6736 Mon Sep 17 00:00:00 2001 From: hayati ayguen Date: Sun, 13 May 2018 11:47:17 +0200 Subject: [PATCH] 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 --- src/SimpleSocket.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SimpleSocket.cpp b/src/SimpleSocket.cpp index 1977e6a..a4fcc5a 100644 --- a/src/SimpleSocket.cpp +++ b/src/SimpleSocket.cpp @@ -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) @@ -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)