diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-12-14 00:44:41 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-12-14 00:44:41 +0000 |
commit | cd8c4f9c3bc3a2907194bb6c3dd7d8227f3bf072 (patch) | |
tree | 232e7073713d845c3938149f4e813998acb39a9e /usr.sbin/ospfd/kroute.c | |
parent | 9b5f0239c7ec2ec23ad4de68f789b4bdb95bcfeb (diff) |
Replace strlcpy() with memcpy() in the sockaddr_dl handling. sdl_data is
not a C string and strlcpy() only works on C strings -- returns length of
the source. Found by tedu@ OK deraadt@ tedu@
Diffstat (limited to 'usr.sbin/ospfd/kroute.c')
-rw-r--r-- | usr.sbin/ospfd/kroute.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/ospfd/kroute.c b/usr.sbin/ospfd/kroute.c index 51a67da19eb..9f924a87143 100644 --- a/usr.sbin/ospfd/kroute.c +++ b/usr.sbin/ospfd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.20 2005/08/08 08:38:42 claudio Exp $ */ +/* $OpenBSD: kroute.c,v 1.21 2005/12/14 00:44:40 claudio Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -884,11 +884,12 @@ fetchifs(int ifindex) if (sa->sa_family == AF_LINK) { sdl = (struct sockaddr_dl *)sa; if (sdl->sdl_nlen >= sizeof(kif->k.ifname)) - strlcpy(kif->k.ifname, sdl->sdl_data, - sizeof(kif->k.ifname)); + memcpy(kif->k.ifname, sdl->sdl_data, + sizeof(kif->k.ifname) - 1); else if (sdl->sdl_nlen > 0) - strlcpy(kif->k.ifname, sdl->sdl_data, - sdl->sdl_nlen + 1); + memcpy(kif->k.ifname, sdl->sdl_data, + sdl->sdl_nlen); + /* string already terminated via calloc() */ } kif_insert(kif); |