summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbeck <beck@openbsd.org>2019-05-30 13:34:54 +0000
committerbeck <beck@openbsd.org>2019-05-30 13:34:54 +0000
commitd136a1603bcdf120a989c0e1a4a66a3f5d3dbffc (patch)
treeeb455a14a86854847b8f9262dc28adc6eac15797 /sys
parent__realpath(2) appears to have improved, so re-enable the code that (diff)
downloadwireguard-openbsd-d136a1603bcdf120a989c0e1a4a66a3f5d3dbffc.tar.xz
wireguard-openbsd-d136a1603bcdf120a989c0e1a4a66a3f5d3dbffc.zip
Fix the initialization of bp before calling vfs_getcwd_common
It is bad style to make a pointer point outside the object so correct this to simply point to the last byte up front. ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_getcwd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/vfs_getcwd.c b/sys/kern/vfs_getcwd.c
index 1d687b9a5f7..2d1bf64fa3b 100644
--- a/sys/kern/vfs_getcwd.c
+++ b/sys/kern/vfs_getcwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_getcwd.c,v 1.35 2019/05/30 13:11:53 deraadt Exp $ */
+/* $OpenBSD: vfs_getcwd.c,v 1.36 2019/05/30 13:34:54 beck Exp $ */
/* $NetBSD: vfs_getcwd.c,v 1.3.2.3 1999/07/11 10:24:09 sommerfeld Exp $ */
/*
@@ -405,8 +405,8 @@ sys___getcwd(struct proc *p, void *v, register_t *retval)
path = malloc(len, M_TEMP, M_WAITOK);
- bp = &path[len];
- *(--bp) = '\0';
+ bp = &path[len - 1];
+ *bp = '\0';
/*
* 5th argument here is "max number of vnodes to traverse".