svn commit: [26221] branches/uClibc_0_9_30/libc/inet

aldot at uclibc.org aldot at uclibc.org
Mon Apr 27 20:07:24 UTC 2009


Author: aldot
Date: 2009-04-27 20:07:23 +0000 (Mon, 27 Apr 2009)
New Revision: 26221

Log:
- getaddrinfo: runp->ifa_addr indeed can be NULL, don't dereference it
- ifaddrs.c: cosmetics, no code changes
  (Both r24336 from trunk)


Modified:
   branches/uClibc_0_9_30/libc/inet/getaddrinfo.c
   branches/uClibc_0_9_30/libc/inet/ifaddrs.c


Changeset:
Modified: branches/uClibc_0_9_30/libc/inet/getaddrinfo.c
===================================================================
--- branches/uClibc_0_9_30/libc/inet/getaddrinfo.c	2009-04-27 14:07:42 UTC (rev 26220)
+++ branches/uClibc_0_9_30/libc/inet/getaddrinfo.c	2009-04-27 20:07:23 UTC (rev 26221)
@@ -187,6 +187,8 @@
 		}
 
 		for (runp = ifa; runp != NULL; runp = runp->ifa_next) {
+			if (runp->ifa_addr == NULL)
+				continue;
 #if defined __UCLIBC_HAS_IPV4__
 			if (runp->ifa_addr->sa_family == PF_INET)
 				seen |= SEEN_IPV4;
@@ -234,7 +236,7 @@
 		ret = 1; /* Assume PF_UNIX. */
 		if (s < 0) {
 			if (errno != EMFILE)
-	        		ret = 0;
+				ret = 0;
 		} else
 			close(s);
 	}

Modified: branches/uClibc_0_9_30/libc/inet/ifaddrs.c
===================================================================
--- branches/uClibc_0_9_30/libc/inet/ifaddrs.c	2009-04-27 14:07:42 UTC (rev 26220)
+++ branches/uClibc_0_9_30/libc/inet/ifaddrs.c	2009-04-27 20:07:23 UTC (rev 26221)
@@ -452,10 +452,7 @@
 
   /* Allocate memory for all entries we have and initialize next
      pointer.  */
-  ifas = (struct ifaddrs_storage *) calloc (1,
-					    (newlink + newaddr)
-					    * sizeof (struct ifaddrs_storage)
-					    + ifa_data_size);
+  ifas = calloc (1, (newlink + newaddr) * sizeof (ifas[0]) + ifa_data_size);
   if (ifas == NULL)
     {
       result = -1;



More information about the uClibc-cvs mailing list