https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e961958823332e3d8790d…
commit e961958823332e3d8790d0a106eb36619cc32ee0
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Thu Jun 17 16:17:44 2021 +0200
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Mon Jun 28 10:20:57 2021 +0200
[NSLOOKUP] Check WSAStartup return value
CORE-17637
---
base/applications/network/nslookup/nslookup.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/base/applications/network/nslookup/nslookup.c
b/base/applications/network/nslookup/nslookup.c
index d86803eb3aa..2f59e268b38 100644
--- a/base/applications/network/nslookup/nslookup.c
+++ b/base/applications/network/nslookup/nslookup.c
@@ -376,7 +376,7 @@ void PerformLookup( PCHAR pAddr )
case RCODE_NXDOMAIN:
_tprintf( _T("*** %s can't find %s: Non-existant domain\n"),
State.DefaultServer, pAddr );
break;
-
+
case RCODE_REFUSED:
_tprintf( _T("*** %s can't find %s: Query refused\n"),
State.DefaultServer, pAddr );
break;
@@ -384,7 +384,7 @@ void PerformLookup( PCHAR pAddr )
default:
_tprintf( _T("*** %s can't find %s: Unknown RCODE\n"),
State.DefaultServer, pAddr );
}
-
+
goto cleanup;
}
@@ -761,6 +761,7 @@ int main( int argc, char* argv[] )
PFIXED_INFO pNetInfo = NULL;
ULONG NetBufLen = 0;
WSADATA wsaData;
+ int ret;
ProcessHeap = GetProcessHeap();
RequestID = 1;
@@ -827,7 +828,12 @@ int main( int argc, char* argv[] )
HeapFree( ProcessHeap, 0, pNetInfo );
- WSAStartup( MAKEWORD(2,2), &wsaData );
+ ret = WSAStartup( MAKEWORD(2, 2), &wsaData );
+ if (ret != 0)
+ {
+ _tprintf( _T("Winsock initialization failed: %d\n"), ret );
+ return ret;
+ }
switch( ParseCommandLine( argc, argv ) )
{