diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2009-09-20 20:27:54 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2009-09-20 20:27:54 +0000 |
commit | fd8bfeb68325dfb179010af0e746bd2e2cb46374 (patch) | |
tree | d787e0cbd91a98fb85d8630c01c8e8236b47d185 /usr.sbin/ospf6d | |
parent | a8c19d41e3a23c8d15abd92805d8790a21d94390 (diff) |
In kif_update(), the ifname array could be used uninitialised if the
caller passed NULL for the sdl parameter.
ok claudio@
Diffstat (limited to 'usr.sbin/ospf6d')
-rw-r--r-- | usr.sbin/ospf6d/kroute.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/ospf6d/kroute.c b/usr.sbin/ospf6d/kroute.c index 28668b861dd..6ecfd06e8f5 100644 --- a/usr.sbin/ospf6d/kroute.c +++ b/usr.sbin/ospf6d/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.12 2009/06/05 22:40:24 chris Exp $ */ +/* $OpenBSD: kroute.c,v 1.13 2009/09/20 20:27:53 stsp Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -609,15 +609,17 @@ kif_update(u_short ifindex, int flags, struct if_data *ifd, char ifname[IF_NAMESIZE]; if ((iface = if_find(ifindex)) == NULL) { + bzero(ifname, sizeof(ifname)); if (sdl && sdl->sdl_family == AF_LINK) { - bzero(ifname, sizeof(ifname)); if (sdl->sdl_nlen >= sizeof(ifname)) memcpy(ifname, sdl->sdl_data, sizeof(ifname) - 1); else if (sdl->sdl_nlen > 0) memcpy(ifname, sdl->sdl_data, sdl->sdl_nlen); - } - + else + return (NULL); + } else + return (NULL); if ((iface = if_new(ifindex, ifname)) == NULL) return (NULL); iface->cflags |= F_IFACE_AVAIL; |