about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/getipv4sourcefilter.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-08-06 09:25:59 +0000
committerUlrich Drepper <drepper@redhat.com>2004-08-06 09:25:59 +0000
commit9030e7c44aa75345336673c0252974ead4eb8364 (patch)
treec898cc7e9f7f6e5559cacaa0c1dc78893628bd54 /sysdeps/unix/sysv/linux/getipv4sourcefilter.c
parenta55bda85baca5feee69b7bc01b9c76f89a6347dd (diff)
downloadglibc-9030e7c44aa75345336673c0252974ead4eb8364.tar.gz
glibc-9030e7c44aa75345336673c0252974ead4eb8364.tar.xz
glibc-9030e7c44aa75345336673c0252974ead4eb8364.zip
Update.
2004-07-30  Guido Guenther  <agx@sigxcpu.org>

	* nss/getent.c (passwd_keys): Use strtoul instead of isdigit to
	test if the key is numeric or not.
	(group_keys): Likewise.
Diffstat (limited to 'sysdeps/unix/sysv/linux/getipv4sourcefilter.c')
-rw-r--r--sysdeps/unix/sysv/linux/getipv4sourcefilter.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sysdeps/unix/sysv/linux/getipv4sourcefilter.c b/sysdeps/unix/sysv/linux/getipv4sourcefilter.c
index 7fad6a7c82..1a4e16cdbd 100644
--- a/sysdeps/unix/sysv/linux/getipv4sourcefilter.c
+++ b/sysdeps/unix/sysv/linux/getipv4sourcefilter.c
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <netinet/in.h>
+#include <sys/param.h>
 #include <sys/socket.h>
 
 
@@ -33,20 +34,21 @@ getipv4sourcefilter (int s, struct in_addr interface, struct in_addr group,
   /* We have to create an struct ip_msfilter object which we can pass
      to the kernel.  */
   socklen_t needed = IP_MSFILTER_SIZE (*numsrc);
-  int use_malloc = __libc_use_alloca (needed);
+  int use_alloca = __libc_use_alloca (needed);
 
   struct ip_msfilter *imsf;
-  if (use_malloc)
+  if (use_alloca)
+    imsf = (struct ip_msfilter *) alloca (needed);
+  else
     {
       imsf = (struct ip_msfilter *) malloc (needed);
       if (imsf == NULL)
 	return -1;
     }
-  else
-    imsf = (struct ip_msfilter *) alloca (needed);
 
   imsf->imsf_multiaddr = group;
   imsf->imsf_interface = interface;
+  imsf->imsf_numsrc = *numsrc;
 
   int result = __getsockopt (s, SOL_IP, IP_MSFILTER, imsf, &needed);
 
@@ -55,12 +57,12 @@ getipv4sourcefilter (int s, struct in_addr interface, struct in_addr group,
   if (result == 0)
     {
       *fmode = imsf->imsf_fmode;
-      *numsrc = imsf->imsf_numsrc;
       memcpy (slist, imsf->imsf_slist,
-	      imsf->imsf_numsrc * sizeof (struct in_addr));
+	      MIN (*numsrc, imsf->imsf_numsrc) * sizeof (struct in_addr));
+      *numsrc = imsf->imsf_numsrc;
     }
 
-  if (use_malloc)
+  if (! use_alloca)
     {
       int save_errno = errno;
       free (imsf);