Possible bug in 3.2.7
Remy Zandwijk
remy.zandwijk at falw.vu.nl
Fri Jan 16 08:40:51 GMT 2009
> And here is the patch. Committing to all post 3.2.x branches.
Shouldn't char addr[INET6_ADDRSTRLEN] be declared globally? Since after the
if-block, we can't be sure the memory is still allocated. And since
'servername' is used further down the code...
-Remy
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index e913b35..b46ff2c 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -1940,11 +1940,12 @@ bool is_myname_or_ipaddr(const char *s)
if (!is_ipaddress(servername)) {
/* Use DNS to resolve the name, but only the first address */
struct sockaddr_storage ss;
- if (interpret_string_addr(&ss, servername,0)) {
- print_sockaddr(name,
- sizeof(name),
+ if (interpret_string_addr(&ss, servername, 0)) {
+ char addr[INET6_ADDRSTRLEN];
+ print_sockaddr(addr,
+ sizeof(addr),
&ss);
- servername = name;
+ servername = addr;
}
}
More information about the samba-technical
mailing list