summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2006-12-29 18:44:04 +0000
committerbz <bz@FreeBSD.org>2006-12-29 18:44:04 +0000
commit7c57814bdcf673bb4e3961b662c3dbf11a8f9c7e (patch)
tree2b3522a0fe426c4599000dc8df3334dd6e74a6b2 /sbin
parentd9a83430ee7af3ac44028bb881fcd6c130654ea2 (diff)
downloadFreeBSD-src-7c57814bdcf673bb4e3961b662c3dbf11a8f9c7e.zip
FreeBSD-src-7c57814bdcf673bb4e3961b662c3dbf11a8f9c7e.tar.gz
Fix an off-by-one which could mean writing beyond the end of the array
when copying the interface name. This code part should probably be rewritten.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ifconfig/ifconfig.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 2210a2f..684bf90 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -321,9 +321,9 @@ retry:
next += nextifm->ifm_msglen;
}
memcpy(name, sdl->sdl_data,
- sizeof(name) < sdl->sdl_nlen ?
+ sizeof(name) <= sdl->sdl_nlen ?
sizeof(name)-1 : sdl->sdl_nlen);
- name[sizeof(name) < sdl->sdl_nlen ?
+ name[sizeof(name) <= sdl->sdl_nlen ?
sizeof(name)-1 : sdl->sdl_nlen] = '\0';
if (all || namesonly) {
OpenPOWER on IntegriCloud