Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 310411
b: refs/heads/master
c: 20e2a86
h: refs/heads/master
i:
  310409: 0aaee37
  310407: 6e05d53
v: v3
  • Loading branch information
Paul Moore authored and David S. Miller committed Jun 1, 2012
1 parent 91cfc36 commit 6c594ef
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 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: cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc
refs/heads/master: 20e2a86485967c385d7c7befc1646e4d1d39362e
29 changes: 28 additions & 1 deletion trunk/include/net/cipso_ipv4.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <net/netlabel.h>
#include <net/request_sock.h>
#include <linux/atomic.h>
#include <asm/unaligned.h>

/* known doi values */
#define CIPSO_V4_DOI_UNKNOWN 0x00000000
Expand Down Expand Up @@ -285,7 +286,33 @@ static inline int cipso_v4_skbuff_getattr(const struct sk_buff *skb,
static inline int cipso_v4_validate(const struct sk_buff *skb,
unsigned char **option)
{
return -ENOSYS;
unsigned char *opt = *option;
unsigned char err_offset = 0;
u8 opt_len = opt[1];
u8 opt_iter;

if (opt_len < 8) {
err_offset = 1;
goto out;
}

if (get_unaligned_be32(&opt[2]) == 0) {
err_offset = 2;
goto out;
}

for (opt_iter = 6; opt_iter < opt_len;) {
if (opt[opt_iter + 1] > (opt_len - opt_iter)) {
err_offset = opt_iter + 1;
goto out;
}
opt_iter += opt[opt_iter + 1];
}

out:
*option = opt + err_offset;
return err_offset;

}
#endif /* CONFIG_NETLABEL */

Expand Down

0 comments on commit 6c594ef

Please sign in to comment.