summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2005-12-13 09:52:21 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2005-12-13 09:52:21 +0000
commit7387c09513bfed0f6b39ff200f1cdb07f2e14997 (patch)
treee7ef671e1ba403d22f84401c8599dd64d89b1534 /usr.bin
parent1fabae1a9a9ca0a8920d56ceb0f214eda4c73d0f (diff)
sdl->sdl_data does not contain a nul terminated string, so use bcopy and
terminate it manually rather than use strlcpy to get the interface name. fixes output on my sparc and sparc64s. ok markus@ deraadt@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/systat/if.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/systat/if.c b/usr.bin/systat/if.c
index 8153ee3c3d8..e27bd8b3df8 100644
--- a/usr.bin/systat/if.c
+++ b/usr.bin/systat/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.2 2004/11/25 23:08:13 deraadt Exp $ */
+/* $OpenBSD: if.c,v 1.3 2005/12/13 09:52:20 dlg Exp $ */
/*
* Copyright (c) 2004 Markus Friedl <markus@openbsd.org>
*
@@ -149,10 +149,11 @@ fetchifstat(void)
ifm.ifm_addrs, info);
if ((sdl = (struct sockaddr_dl *)info[RTAX_IFP])) {
if (sdl->sdl_family == AF_LINK &&
- sdl->sdl_nlen > 0)
- strlcpy(ifs->ifs_name,
- sdl->sdl_data,
- sizeof(ifs->ifs_name));
+ sdl->sdl_nlen > 0) {
+ bcopy(sdl->sdl_data, ifs->ifs_name,
+ sdl->sdl_nlen);
+ ifs->ifs_name[sdl->sdl_nlen] = '\0';
+ }
}
if (ifs->ifs_name[0] == '\0')
continue;