summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-06-09 17:32:36 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-06-09 17:32:36 +0000
commitb34f774bbf1f7c4a735e2fa11d6e5948e474ba0e (patch)
treeaa3de9755c1484be76177ae0f16340656d27e5ae /sys/net
parent9d3f1d92976d4fdc0ad510aa754243ca5d964d1e (diff)
make sure to bzero sockaddr_in
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_gre.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index e87e9b68188..80c33221db6 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.19 2002/06/09 17:25:58 itojun Exp $ */
+/* $OpenBSD: if_gre.c,v 1.20 2002/06/09 17:32:35 itojun Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -513,11 +513,17 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
}
break;
case GREGADDRS:
+ bzero(&si, sizeof(si));
+ si.sin_family = AF_INET;
+ si.sin_len = sizeof(struct sockaddr_in);
si.sin_addr.s_addr = sc->g_src.s_addr;
sa = sintosa(&si);
ifr->ifr_addr = *sa;
break;
case GREGADDRD:
+ bzero(&si, sizeof(si));
+ si.sin_family = AF_INET;
+ si.sin_len = sizeof(struct sockaddr_in);
si.sin_addr.s_addr = sc->g_dst.s_addr;
sa = sintosa(&si);
ifr->ifr_addr = *sa;
@@ -551,16 +557,13 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
error = EADDRNOTAVAIL;
break;
}
+ bzero(&si, sizeof(si));
si.sin_family = AF_INET;
si.sin_len = sizeof(struct sockaddr_in);
si.sin_addr.s_addr = sc->g_src.s_addr;
- sa = sintosa(&si);
- memcpy(&lifr->addr, sa, sa->sa_len);
- si.sin_family = AF_INET;
- si.sin_len = sizeof(struct sockaddr_in);
+ memcpy(&lifr->addr, &si, sizeof(si));
si.sin_addr.s_addr = sc->g_dst.s_addr;
- sa = sintosa(&si);
- memcpy(&lifr->dstaddr, sa, sa->sa_len);
+ memcpy(&lifr->dstaddr, &si, sizeof(si));
break;
default:
error = EINVAL;