Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 167278
b: refs/heads/master
c: a8ba8bf
h: refs/heads/master
v: v3
  • Loading branch information
Serge E. Hallyn authored and Greg Kroah-Hartman committed Oct 9, 2009
1 parent be1215a commit 58167db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 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: 3d14b518481eb1fa10c6f6ef9efd5f4cc0f84b28
refs/heads/master: a8ba8bffbe1f3f8b3450d294b9e68d299b158209
14 changes: 8 additions & 6 deletions trunk/drivers/staging/p9auth/p9auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ static ssize_t cap_write(struct file *filp, const char __user *buf,
user_buf_running = NULL;
hash_str = NULL;
node_ptr = kmalloc(sizeof(struct cap_node), GFP_KERNEL);
user_buf = kzalloc(count, GFP_KERNEL);
user_buf = kzalloc(count+1, GFP_KERNEL);
if (!node_ptr || !user_buf)
goto out;

Expand All @@ -207,6 +207,7 @@ static ssize_t cap_write(struct file *filp, const char __user *buf,
list_add(&(node_ptr->list), &(dev->head->list));
node_ptr = NULL;
} else {
char *tmpu;
if (!cap_devices[0].head ||
list_empty(&(cap_devices[0].head->list))) {
retval = -EINVAL;
Expand All @@ -218,18 +219,19 @@ static ssize_t cap_write(struct file *filp, const char __user *buf,
* need to split it and hash 'user1@user2' using 'randomstring'
* as the key.
*/
user_buf_running = kstrdup(user_buf, GFP_KERNEL);
source_user = strsep(&user_buf_running, "@");
target_user = strsep(&user_buf_running, "@");
rand_str = strsep(&user_buf_running, "@");
tmpu = user_buf_running = kstrdup(user_buf, GFP_KERNEL);
source_user = strsep(&tmpu, "@");
target_user = strsep(&tmpu, "@");
rand_str = tmpu;
if (!source_user || !target_user || !rand_str) {
retval = -EINVAL;
goto out;
}

/* hash the string user1@user2 with rand_str as the key */
len = strlen(source_user) + strlen(target_user) + 1;
hash_str = kzalloc(len, GFP_KERNEL);
/* src, @, len, \0 */
hash_str = kzalloc(len+1, GFP_KERNEL);
strcat(hash_str, source_user);
strcat(hash_str, "@");
strcat(hash_str, target_user);
Expand Down

0 comments on commit 58167db

Please sign in to comment.