X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=interfaces.c;h=502cb94ae5e4afb39b399d1056fd2a6edfd6844a;hb=599b9cba883f6308232ec634819df2a3a20fc731;hp=27ca4382e61be90a7ad65eb53c340409903942c9;hpb=812709a155f4e8ca2a6b6070bad027a372835857;p=debian%2Fsudo diff --git a/interfaces.c b/interfaces.c index 27ca438..502cb94 100644 --- a/interfaces.c +++ b/interfaces.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1998-2005, 2007-2008 + * Copyright (c) 1996, 1998-2005, 2007-2010 * Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any @@ -52,11 +52,10 @@ struct rtentry; # include # endif # include -#else -# ifdef HAVE_STRINGS_H -# include -# endif #endif /* HAVE_STRING_H */ +#ifdef HAVE_STRINGS_H +# include +#endif /* HAVE_STRINGS_H */ #ifdef HAVE_UNISTD_H # include #endif /* HAVE_UNISTD_H */ @@ -84,10 +83,10 @@ struct rtentry; #include "sudo.h" #include "interfaces.h" -#ifndef lint -__unused static const char rcsid[] = "$Sudo: interfaces.c,v 1.84 2008/11/09 14:13:12 millert Exp $"; -#endif /* lint */ - +/* Minix apparently lacks IFF_LOOPBACK */ +#ifndef IFF_LOOPBACK +# define IFF_LOOPBACK 0 +#endif #ifdef HAVE_GETIFADDRS @@ -139,9 +138,13 @@ load_interfaces() switch(ifa->ifa_addr->sa_family) { case AF_INET: sin = (struct sockaddr_in *)ifa->ifa_addr; + if (sin == NULL) + continue; memcpy(&interfaces[i].addr, &sin->sin_addr, sizeof(struct in_addr)); sin = (struct sockaddr_in *)ifa->ifa_netmask; + if (sin == NULL) + continue; memcpy(&interfaces[i].netmask, &sin->sin_addr, sizeof(struct in_addr)); interfaces[i].family = AF_INET; @@ -150,9 +153,13 @@ load_interfaces() #ifdef HAVE_IN6_ADDR case AF_INET6: sin6 = (struct sockaddr_in6 *)ifa->ifa_addr; + if (sin6 == NULL) + continue; memcpy(&interfaces[i].addr, &sin6->sin6_addr, sizeof(struct in6_addr)); sin6 = (struct sockaddr_in6 *)ifa->ifa_netmask; + if (sin6 == NULL) + continue; memcpy(&interfaces[i].netmask, &sin6->sin6_addr, sizeof(struct in6_addr)); interfaces[i].family = AF_INET6;