OPENAFS-SA-2024-003: sys: Don't over-copy RMTSYS_Pioctl output data

CVE-2024-10397

Here, 'OutData' only has OutData.rmtbulk_len bytes in it. We know that
OutData.rmtbulk_len is at most data->out_size, but it could be
smaller. So, only copy OutData.rmtbulk_len bytes, not data->out_size,
since data->out_size could be more than the number of bytes we have
allocated in OutData.

FIXES 135043

Change-Id: I6f87fc8cb5df0298061f419112200f6c7e1974ba
Reviewed-on: https://gerrit.openafs.org/15924
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Andrew Deason 2020-10-16 10:55:15 -05:00 committed by Benjamin Kaduk
parent 1f5e1ef9e3
commit f31a79d749

View File

@ -260,7 +260,7 @@ pioctl(char *path, afs_int32 cmd, struct ViceIoctl *data, afs_int32 follow)
errno = EINVAL;
errorcode = -1;
} else {
memcpy(data->out, OutData.rmtbulk_val, data->out_size);
memcpy(data->out, OutData.rmtbulk_val, OutData.rmtbulk_len);
outparam_conversion(cmd, data->out, 1);
}
}