Commit 35ac734f authored by Dan Carpenter's avatar Dan Carpenter Committed by Martin Schwidefsky

[S390] sclp_async: potential buffer overflow

"len" hasn't been properly range checked so we shouldn't use it as an
array offset.  This can only be written to by root but it would still be
annoying to accidentally write more than 3 characters and corrupt your
memory.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent d7015c12
...@@ -85,7 +85,7 @@ static int proc_handler_callhome(struct ctl_table *ctl, int write, ...@@ -85,7 +85,7 @@ static int proc_handler_callhome(struct ctl_table *ctl, int write,
rc = copy_from_user(buf, buffer, sizeof(buf)); rc = copy_from_user(buf, buffer, sizeof(buf));
if (rc != 0) if (rc != 0)
return -EFAULT; return -EFAULT;
buf[len - 1] = '\0'; buf[sizeof(buf) - 1] = '\0';
if (strict_strtoul(buf, 0, &val) != 0) if (strict_strtoul(buf, 0, &val) != 0)
return -EINVAL; return -EINVAL;
if (val != 0 && val != 1) if (val != 0 && val != 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment