summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-04 22:20:04 -0800
committerJeremy Allison <jra@samba.org>2007-11-04 22:20:04 -0800
commit536a9e79222e3e49514386feae30470cdd171871 (patch)
treeef4af683e9969fb132f124f811cd64fcd1e36041
parent6a2a27076ff298d747038d4feaf288b263ba31f5 (diff)
downloadsamba-536a9e79222e3e49514386feae30470cdd171871.tar.gz
samba-536a9e79222e3e49514386feae30470cdd171871.tar.bz2
samba-536a9e79222e3e49514386feae30470cdd171871.zip
Don't alloc struct iface_struct nics[MAX_INTERFACES]; (128 entries)
on the stack - use talloc. Jeremy (This used to be commit b5e37af251a26648b0e4f59ca548c5374399175e)
-rw-r--r--source3/lib/util_sock.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index d87d954536..02097239cf 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -2082,7 +2082,7 @@ bool is_myname_or_ipaddr(const char *s)
/* Maybe its an IP address? */
if (is_ipaddress(servername)) {
struct sockaddr_storage ss;
- struct iface_struct nics[MAX_INTERFACES];
+ struct iface_struct *nics;
int i, n;
if (!interpret_string_addr(&ss, servername, AI_NUMERICHOST)) {
@@ -2093,12 +2093,19 @@ bool is_myname_or_ipaddr(const char *s)
return false;
}
+ nics = TALLOC_ARRAY(talloc_tos(), struct iface_struct,
+ MAX_INTERFACES);
+ if (!nics) {
+ return false;
+ }
n = get_interfaces(nics, MAX_INTERFACES);
for (i=0; i<n; i++) {
if (addr_equal(&nics[i].ip, &ss)) {
+ TALLOC_FREE(nics);
return true;
}
}
+ TALLOC_FREE(nics);
}
/* No match */