mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
simplify path handling in sysctl_try_reclaim_vnode
MAXPATHLEN / PATH_MAX includes space for the terminating NUL, and namei verifies the presence of the NUL. Thus there is no need to increase the buffer size here. The sysctl passes the string excluding the NUL, so req->newlen equal to PATH_MAX is too long. Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21876
This commit is contained in:
parent
31f1c8fc84
commit
f91dd6091b
1 changed files with 2 additions and 2 deletions
|
|
@ -351,10 +351,10 @@ sysctl_try_reclaim_vnode(SYSCTL_HANDLER_ARGS)
|
|||
|
||||
if (req->newptr == NULL)
|
||||
return (EINVAL);
|
||||
if (req->newlen > PATH_MAX)
|
||||
if (req->newlen >= PATH_MAX)
|
||||
return (E2BIG);
|
||||
|
||||
buf = malloc(PATH_MAX + 1, M_TEMP, M_WAITOK);
|
||||
buf = malloc(PATH_MAX, M_TEMP, M_WAITOK);
|
||||
error = SYSCTL_IN(req, buf, req->newlen);
|
||||
if (error != 0)
|
||||
goto out;
|
||||
|
|
|
|||
Loading…
Reference in a new issue