瀏覽代碼

check return of getaddrinfo in network layer

Infinity95 7 年之前
父節點
當前提交
3ac07db14d
共有 1 個文件被更改,包括 2 次插入1 次删除
  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. */