Pārlūkot izejas kodu

check return of getaddrinfo in network layer

Infinity95 7 gadi atpakaļ
vecāks
revīzija
3ac07db14d
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  1. 2 1
      plugins/ua_network_tcp.c

+ 2 - 1
plugins/ua_network_tcp.c

@@ -410,7 +410,8 @@ ServerNetworkLayerTCP_start(UA_ServerNetworkLayer *nl) {
     hints.ai_family = AF_UNSPEC;
     hints.ai_socktype = SOCK_STREAM;
     hints.ai_flags = AI_PASSIVE;
-    getaddrinfo(NULL, portno, &hints, &res);
+    if(getaddrinfo(NULL, portno, &hints, &res) != 0)
+        return UA_STATUSCODE_BADINTERNALERROR;
 
     /* There might be serveral addrinfos (for different network cards,
      * IPv4/IPv6). Add a server socket for all of them. */