summaryrefslogtreecommitdiff
path: root/usr.sbin/afs
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-04-24 20:14:04 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-04-24 20:14:04 +0000
commita77aeef3007ef2354b5fa6121234b5616341de79 (patch)
treef9dcdb805514b50ddf6333766159d5290b087542 /usr.sbin/afs
parent3c9553c3061dee4d502abef038244c83cb546d90 (diff)
better bounds for strlcpy. from lha@stacken via janj+openbsd at wenf.org.
thanks
Diffstat (limited to 'usr.sbin/afs')
-rw-r--r--usr.sbin/afs/src/lib/bufdir/fdir.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/afs/src/lib/bufdir/fdir.c b/usr.sbin/afs/src/lib/bufdir/fdir.c
index 240d337195e..3c453e0e90e 100644
--- a/usr.sbin/afs/src/lib/bufdir/fdir.c
+++ b/usr.sbin/afs/src/lib/bufdir/fdir.c
@@ -287,8 +287,8 @@ add_to_page (DirPage0 *page0,
page->entry[i].next = next;
page->entry[i].fid.Vnode = htonl(fid.Vnode);
page->entry[i].fid.Unique = htonl(fid.Unique);
- /* XXX find a better bound. very unusual buffer handling */
- strlcpy (page->entry[i].name, filename, strlen(filename) + 1);
+ strlcpy (page->entry[i].name, filename, (n - 1) * sizeof(DirEntry)
+ + sizeof(page->entry[i].name));
memset(page->entry[i + j - 1].fill, 0, 4);
if (pageno < MAXPAGES)
page0->dheader.map[pageno] -= n;