|
@@ -238,7 +238,7 @@ SYSCALL_DEFINE2(capget, cap_user_header_t, header, cap_user_data_t, dataptr)
|
|
SYSCALL_DEFINE2(capset, cap_user_header_t, header, const cap_user_data_t, data)
|
|
SYSCALL_DEFINE2(capset, cap_user_header_t, header, const cap_user_data_t, data)
|
|
{
|
|
{
|
|
struct __user_cap_data_struct kdata[_KERNEL_CAPABILITY_U32S];
|
|
struct __user_cap_data_struct kdata[_KERNEL_CAPABILITY_U32S];
|
|
- unsigned i, tocopy;
|
|
|
|
|
|
+ unsigned i, tocopy, copybytes;
|
|
kernel_cap_t inheritable, permitted, effective;
|
|
kernel_cap_t inheritable, permitted, effective;
|
|
struct cred *new;
|
|
struct cred *new;
|
|
int ret;
|
|
int ret;
|
|
@@ -255,8 +255,11 @@ SYSCALL_DEFINE2(capset, cap_user_header_t, header, const cap_user_data_t, data)
|
|
if (pid != 0 && pid != task_pid_vnr(current))
|
|
if (pid != 0 && pid != task_pid_vnr(current))
|
|
return -EPERM;
|
|
return -EPERM;
|
|
|
|
|
|
- if (copy_from_user(&kdata, data,
|
|
|
|
- tocopy * sizeof(struct __user_cap_data_struct)))
|
|
|
|
|
|
+ copybytes = tocopy * sizeof(struct __user_cap_data_struct);
|
|
|
|
+ if (copybytes > sizeof(kdata))
|
|
|
|
+ return -EFAULT;
|
|
|
|
+
|
|
|
|
+ if (copy_from_user(&kdata, data, copybytes))
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
|
|
|
|
for (i = 0; i < tocopy; i++) {
|
|
for (i = 0; i < tocopy; i++) {
|