From af2dda555adfa71bc6a84e04f72523273aca6c16 Mon Sep 17 00:00:00 2001 From: Antoine Verheijen Date: Mon, 8 Apr 2013 20:29:58 -0600 Subject: [PATCH] OpenBSD 5.3: Replace use of copyinstr for setting mount point name. As a result of a realignment of kernel memory in OpenBSD 5.3, the copyinstr() routine no longer works for copying the mount point name into the internal mount table structure. It also fails silently, so it's not noticed until someone looks at the mount table and discovers that the mount point name for AFS is missing. This patch replaces the use of copyinstr() with strlcpy() for copying the mount point name in OpenBSD 5.3. Note that this is consistent with how other similar device support has addressed the same issue in OpenBSD 5.3. Reviewed-on: http://gerrit.openafs.org/9752 Reviewed-by: Derrick Brashear Tested-by: BuildBot (cherry picked from commit b39461fc67d4f258d31e0a13b5d8dcb3c5fae49f) Change-Id: I5e9a3d0871360e0e3b19cdb2b4a609baeed050f8 Reviewed-on: http://gerrit.openafs.org/9908 Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk Tested-by: BuildBot Reviewed-by: Stephan Wiesand --- src/afs/OBSD/osi_vfsops.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/afs/OBSD/osi_vfsops.c b/src/afs/OBSD/osi_vfsops.c index 7b4125fb3..3db75e2a6 100644 --- a/src/afs/OBSD/osi_vfsops.c +++ b/src/afs/OBSD/osi_vfsops.c @@ -245,8 +245,13 @@ afs_mount(mp, path, data, ndp, p) mp->osi_vfs_fsid.val[0] = AFS_VFSMAGIC; /* magic */ mp->osi_vfs_fsid.val[1] = (int)AFS_VFSFSID; +#if defined(AFS_OBSD53_ENV) + bzero(mp->mnt_stat.f_mntonname, MNAMELEN); + strlcpy(mp->mnt_stat.f_mntonname, path, MNAMELEN); +#else (void)copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size); +#endif bzero(mp->mnt_stat.f_mntfromname, MNAMELEN); strcpy(mp->mnt_stat.f_mntfromname, "AFS"); /* null terminated string "AFS" will fit, just leave it be. */ -- 2.39.5