Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15375
b: refs/heads/master
c: de9e007
h: refs/heads/master
i:
  15373: 254597f
  15371: ee22bcb
  15367: 6b2b827
  15359: dfd735e
v: v3
  • Loading branch information
Linus Torvalds committed Jan 1, 2006
1 parent 9acc044 commit 289d521
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 35f349ee082de0be45eb23926d9fc7569f5011f0
refs/heads/master: de9e007d9105bf8fa613a89810feff32a43add03
25 changes: 15 additions & 10 deletions trunk/kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2192,27 +2192,32 @@ int sysctl_string(ctl_table *table, int __user *name, int nlen,
void __user *oldval, size_t __user *oldlenp,
void __user *newval, size_t newlen, void **context)
{
size_t l, len;

if (!table->data || !table->maxlen)
return -ENOTDIR;

if (oldval && oldlenp) {
if (get_user(len, oldlenp))
size_t bufsize;
if (get_user(bufsize, oldlenp))
return -EFAULT;
if (len) {
l = strlen(table->data)+1;
if (len > l) len = l;
if (len >= table->maxlen)
if (bufsize) {
size_t len = strlen(table->data), copied;

/* This shouldn't trigger for a well-formed sysctl */
if (len > table->maxlen)
len = table->maxlen;
if(copy_to_user(oldval, table->data, len))

/* Copy up to a max of bufsize-1 bytes of the string */
copied = (len >= bufsize) ? bufsize - 1 : len;

if (copy_to_user(oldval, table->data, copied) ||
put_user(0, (char __user *)(oldval + copied)))
return -EFAULT;
if(put_user(len, oldlenp))
if (put_user(len, oldlenp))
return -EFAULT;
}
}
if (newval && newlen) {
len = newlen;
size_t len = newlen;
if (len > table->maxlen)
len = table->maxlen;
if(copy_from_user(table->data, newval, len))
Expand Down

0 comments on commit 289d521

Please sign in to comment.