summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2005-04-28 13:49:12 +0000
committerclaudio <claudio@openbsd.org>2005-04-28 13:49:12 +0000
commit398d75a505217504ab4d030f53a17c4c0b9cc16f (patch)
treee8f09543f5bc9fa53a279010565069297d6a9a43
parentRun this test on all shared address space machines. With help from (diff)
downloadwireguard-openbsd-398d75a505217504ab4d030f53a17c4c0b9cc16f.tar.xz
wireguard-openbsd-398d75a505217504ab4d030f53a17c4c0b9cc16f.zip
Be more careful when copying ifname from the struct sockaddr_dl.
OK henning@
-rw-r--r--usr.sbin/bgpd/kroute.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index 2680803b888..daac81ea272 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.123 2005/04/18 11:07:55 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.124 2005/04/28 13:49:12 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -1308,9 +1308,12 @@ fetchifs(int ifindex)
if ((sa = rti_info[RTAX_IFP]) != NULL)
if (sa->sa_family == AF_LINK) {
sdl = (struct sockaddr_dl *)sa;
- if (sdl->sdl_nlen > 0)
+ if (sdl->sdl_nlen >= sizeof(kif->k.ifname))
strlcpy(kif->k.ifname, sdl->sdl_data,
sizeof(kif->k.ifname));
+ else if (sdl->sdl_nlen > 0)
+ strlcpy(kif->k.ifname, sdl->sdl_data,
+ sdl->sdl_nlen + 1);
}
kif_insert(kif);