aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Yonan <james@openvpn.net>2011-02-14 05:20:23 +0000
committerJames Yonan <james@openvpn.net>2011-02-14 05:20:23 +0000
commit3f7c03a23e097f69b716ea79a79848e5ba0a4303 (patch)
tree49bc6fced18e38e0b8c6ab44811866cf71500bde
parentImplemented get_default_gateway_mac_addr for Mac OS X (previously, (diff)
downloadopenvpn-3f7c03a23e097f69b716ea79a79848e5ba0a4303.tar.xz
Fixes to r6925.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@6927 e7ae566f-a301-0410-adde-c780ea21d3b5
-rw-r--r--route.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/route.c b/route.c
index 711f7f9..c3e4acf 100644
--- a/route.c
+++ b/route.c
@@ -1800,7 +1800,7 @@ struct rtmsg {
};
#define ROUNDUP(a) \
- ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(uint32_t) - 1))) : sizeof(uint32_t))
static bool
get_default_gateway_ex (in_addr_t *ret, in_addr_t *netmask, char **ifname)
@@ -2359,7 +2359,7 @@ get_default_gateway_mac_addr (unsigned char *macaddr)
goto done;
}
- buffer = (char *) gc_malloc (bufsize, false, &gc);
+ buffer = (char *) gc_malloc (bufsize, true, &gc);
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0)
@@ -2377,7 +2377,7 @@ get_default_gateway_mac_addr (unsigned char *macaddr)
goto done;
}
- for (cp = buffer; cp < buffer + bufsize; )
+ for (cp = buffer; cp <= buffer + bufsize - sizeof(struct ifreq); )
{
ifr = (struct ifreq *)cp;
if (ifr->ifr_addr.sa_family == AF_LINK && !strncmp(ifr->ifr_name, ifname, IFNAMSIZ))