1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-03 09:00:21 +00:00

ffs: Correct the input size check in sysctl_ffs_fsck()

Make sure we return an error if no input was specified, since
SYSCTL_IN() will report success in that case.

Reported by:	KMSAN
Reviewed by:	mckusick
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30586
This commit is contained in:
Mark Johnston 2021-05-31 18:56:34 -04:00
parent f96603b56f
commit b2f9575646

View File

@ -3211,9 +3211,9 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS)
cap_rights_t rights;
int filetype, error;
if (req->newlen > sizeof cmd)
if (req->newptr == NULL || req->newlen > sizeof(cmd))
return (EBADRPC);
if ((error = SYSCTL_IN(req, &cmd, sizeof cmd)) != 0)
if ((error = SYSCTL_IN(req, &cmd, sizeof(cmd))) != 0)
return (error);
if (cmd.version != FFS_CMD_VERSION)
return (ERPCMISMATCH);