Przeglądaj źródła

* Fixed a DNS memory corruption issue

svn: 1135
Bryan Drewery 22 lat temu
rodzic
commit
1f96e511fc
2 zmienionych plików z 5 dodań i 2 usunięć
  1. 1 0
      doc/UPDATES
  2. 4 2
      src/net.c

+ 1 - 0
doc/UPDATES

@@ -5,6 +5,7 @@ This is a summary of ChangeLog basically.
 1.Fixed cmd_help to display the proper entry.
 2.HUBS now save userfile on remote cmd_chattr.
 3.cmd_bots was showing all bots instead of just the ones up.
+4.Fixed a memory corruption bug caused by failed DNS.
 
 1.1.8
 

+ 4 - 2
src/net.c

@@ -136,7 +136,8 @@ int get_ip(char *hostname, union sockaddr_union *so)
   hints.ai_socktype = SOCK_STREAM;
 
   if ((error = getaddrinfo(hostname, NULL, &hints, &res))) {
-    freeaddrinfo(res);
+    if (res)
+      freeaddrinfo(res);
     return error;
   }
 
@@ -149,7 +150,8 @@ int get_ip(char *hostname, union sockaddr_union *so)
     }
   }
 
-  freeaddrinfo(res);
+  if (res)
+    freeaddrinfo(res);
   return error;
 #else