Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352131
b: refs/heads/master
c: 241448c
h: refs/heads/master
i:
  352129: 1752c69
  352127: 303694c
v: v3
  • Loading branch information
Daniel Borkmann authored and David S. Miller committed Feb 8, 2013
1 parent d98e104 commit edfe330
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 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: 85bd1798b24a13462d7b064961e7a9da3bb12db1
refs/heads/master: 241448c2b84ff02a46ce88199e05fdeb55bad449
21 changes: 12 additions & 9 deletions trunk/net/sctp/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,27 +200,30 @@ static struct sctp_auth_bytes *sctp_auth_make_key_vector(
struct sctp_auth_bytes *new;
__u32 len;
__u32 offset = 0;
__u16 random_len, hmacs_len, chunks_len = 0;

len = ntohs(random->param_hdr.length) + ntohs(hmacs->param_hdr.length);
if (chunks)
len += ntohs(chunks->param_hdr.length);
random_len = ntohs(random->param_hdr.length);
hmacs_len = ntohs(hmacs->param_hdr.length);
if (chunks)
chunks_len = ntohs(chunks->param_hdr.length);

len = random_len + hmacs_len + chunks_len;

new = kmalloc(sizeof(struct sctp_auth_bytes) + len, gfp);
if (!new)
return NULL;

new->len = len;

memcpy(new->data, random, ntohs(random->param_hdr.length));
offset += ntohs(random->param_hdr.length);
memcpy(new->data, random, random_len);
offset += random_len;

if (chunks) {
memcpy(new->data + offset, chunks,
ntohs(chunks->param_hdr.length));
offset += ntohs(chunks->param_hdr.length);
memcpy(new->data + offset, chunks, chunks_len);
offset += chunks_len;
}

memcpy(new->data + offset, hmacs, ntohs(hmacs->param_hdr.length));
memcpy(new->data + offset, hmacs, hmacs_len);

return new;
}
Expand Down

0 comments on commit edfe330

Please sign in to comment.