ocs_fc: Ensure that we zero-initialize memory before copying it out.

Note that the affected interface is available only to root.

admbugs:	765
Reported by:	Vlad Tsyrklevich <vlad@tsyrklevich.net>
Reviewed by:	emaste, ram
MFC after:	1 day
Security:	Kernel memory disclosure
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18914
This commit is contained in:
Mark Johnston 2019-01-23 17:28:39 +00:00
parent 797f009d59
commit f9be23fd42
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343348

View File

@ -851,6 +851,7 @@ ocs_mgmt_firmware_write(ocs_t *ocs, char *name, void *buf, uint32_t buf_len, voi
if (arg_out_length > sizeof(status_str)) {
arg_out_length = sizeof(status_str);
}
ocs_memset(status_str, 0, sizeof(status_str));
ocs_snprintf(status_str, arg_out_length, "%d", change_status);
if (ocs_copy_to_user(arg_out, status_str, arg_out_length)) {
ocs_log_test(ocs, "copy to user failed for change_status\n");