diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2019-07-23 11:01:33 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2019-07-23 11:01:33 +0000 |
commit | 02a754552fb99e26baabaae41e6cb2e184f0ca45 (patch) | |
tree | 6a4ed01b98667416305733ffeaa29ed45a1ac787 /sys/kern/vfs_syscalls.c | |
parent | 49a8422db1d5d1ba7aa58b260fe133409042b3ed (diff) |
Fix realpath(3) errno code for an empty input path string.
It should return ENOENT in this case, but was returning EINVAL.
ok bluhm@ deraadt@
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r-- | sys/kern/vfs_syscalls.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 9a59d467756..0ab28d8481a 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.325 2019/07/22 16:43:10 anton Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.326 2019/07/23 11:01:32 stsp Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -890,6 +890,10 @@ sys___realpath(struct proc *p, void *v, register_t *retval) &pathlen))) goto end; + if (pathlen == 1) { /* empty string "" */ + error = ENOENT; + goto end; + } if (pathlen < 2) { error = EINVAL; goto end; |