Explorar el Código

check return of getaddrinfo in network layer

Infinity95 hace 7 años
padre
commit
3ac07db14d
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  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. */