summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2003-04-24 20:14:03 +0000
committertedu <tedu@openbsd.org>2003-04-24 20:14:03 +0000
commit1e0466e6991e4a26f1510d9db0b7f9a789f8ab58 (patch)
treea8e66023e06096f594fa2064546e8952a133561a
parentget rid of incorrectly sized buffer by using asprintf; ok millert (diff)
downloadwireguard-openbsd-1e0466e6991e4a26f1510d9db0b7f9a789f8ab58.tar.xz
wireguard-openbsd-1e0466e6991e4a26f1510d9db0b7f9a789f8ab58.zip
better bounds for strlcpy. from lha@stacken via janj+openbsd at wenf.org.
thanks
-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;