Browse Source

check return of getaddrinfo in network layer

Infinity95 7 years ago
parent
commit
3ac07db14d
1 changed files with 2 additions and 1 deletions
  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_family = AF_UNSPEC;
     hints.ai_socktype = SOCK_STREAM;
     hints.ai_socktype = SOCK_STREAM;
     hints.ai_flags = AI_PASSIVE;
     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,
     /* There might be serveral addrinfos (for different network cards,
      * IPv4/IPv6). Add a server socket for all of them. */
      * IPv4/IPv6). Add a server socket for all of them. */