OSDN Git Service
(root)
/
tomoyo
/
tomoyo-test1.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
bpf: Check address length before reading address family
[tomoyo/tomoyo-test1.git]
/
net
/
core
/
filter.c
diff --git
a/net/core/filter.c
b/net/core/filter.c
index
fc92ebc
..
27e61ff
100644
(file)
--- a/
net/core/filter.c
+++ b/
net/core/filter.c
@@
-4383,6
+4383,8
@@
BPF_CALL_3(bpf_bind, struct bpf_sock_addr_kern *, ctx, struct sockaddr *, addr,
* Only binding to IP is supported.
*/
err = -EINVAL;
+ if (addr_len < offsetofend(struct sockaddr, sa_family))
+ return err;
if (addr->sa_family == AF_INET) {
if (addr_len < sizeof(struct sockaddr_in))
return err;