summaryrefslogtreecommitdiffstats
path: root/sbin/routed
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2009-04-05 17:12:13 +0000
committerphk <phk@FreeBSD.org>2009-04-05 17:12:13 +0000
commitad4b733279aa875e4206faa43e9fc10f80660489 (patch)
tree35935be787c62ec6de99e4be9a40437253802f6f /sbin/routed
parentd7fb1c4ef8d673cc1bf356fe5c0839710478bb6b (diff)
downloadFreeBSD-src-ad4b733279aa875e4206faa43e9fc10f80660489.zip
FreeBSD-src-ad4b733279aa875e4206faa43e9fc10f80660489.tar.gz
Fix casts which are not by definition safe, but which malloc(3)
makes safe for us.
Diffstat (limited to 'sbin/routed')
-rw-r--r--sbin/routed/if.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/routed/if.c b/sbin/routed/if.c
index 9b05457..61ac412 100644
--- a/sbin/routed/if.c
+++ b/sbin/routed/if.c
@@ -640,7 +640,7 @@ rt_xaddrs(struct rt_addrinfo *info,
void
ifinit(void)
{
- static char *sysctl_buf;
+ static struct ifa_msghdr *sysctl_buf;
static size_t sysctl_buf_size = 0;
uint complaints = 0;
static u_int prev_complaints = 0;
@@ -659,7 +659,8 @@ ifinit(void)
size_t needed;
int mib[6];
struct if_msghdr *ifm;
- struct ifa_msghdr *ifam, *ifam_lim, *ifam2;
+ void *ifam_lim;
+ struct ifa_msghdr *ifam, *ifam2;
int in, ierr, out, oerr;
struct intnet *intnetp;
struct rt_addrinfo info;
@@ -702,10 +703,9 @@ ifinit(void)
"ifinit sysctl");
}
- ifam_lim = (struct ifa_msghdr *)(sysctl_buf + needed);
- for (ifam = (struct ifa_msghdr *)sysctl_buf;
- ifam < ifam_lim;
- ifam = ifam2) {
+ /* XXX: thanks to malloc(3), alignment can be presumed OK */
+ ifam_lim = (char *)sysctl_buf + needed;
+ for (ifam = sysctl_buf; (void *)ifam < ifam_lim; ifam = ifam2) {
ifam2 = (struct ifa_msghdr*)((char*)ifam + ifam->ifam_msglen);
OpenPOWER on IntegriCloud