1 |
naota 12/04/02 10:13:19 |
2 |
|
3 |
Added: freebsd-sources-8.2-unix2.patch |
4 |
Log: |
5 |
Add patch to deal with FreeBSD SA 11:05. #408889 |
6 |
|
7 |
(Portage version: 2.2.0_alpha89/cvs/FreeBSD i386) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 sys-freebsd/freebsd-sources/files/freebsd-sources-8.2-unix2.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-freebsd/freebsd-sources/files/freebsd-sources-8.2-unix2.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-freebsd/freebsd-sources/files/freebsd-sources-8.2-unix2.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: freebsd-sources-8.2-unix2.patch |
16 |
=================================================================== |
17 |
Index: sys/kern/uipc_usrreq.c |
18 |
=================================================================== |
19 |
--- sys/kern/uipc_usrreq.c (revision 225745) |
20 |
+++ sys/kern/uipc_usrreq.c (working copy) |
21 |
@@ -462,6 +462,8 @@ |
22 |
unp = sotounpcb(so); |
23 |
KASSERT(unp != NULL, ("uipc_bind: unp == NULL")); |
24 |
|
25 |
+ if (soun->sun_len > sizeof(struct sockaddr_un)) |
26 |
+ return (EINVAL); |
27 |
namelen = soun->sun_len - offsetof(struct sockaddr_un, sun_path); |
28 |
if (namelen <= 0) |
29 |
return (EINVAL); |
30 |
@@ -1252,6 +1254,8 @@ |
31 |
unp = sotounpcb(so); |
32 |
KASSERT(unp != NULL, ("unp_connect: unp == NULL")); |
33 |
|
34 |
+ if (nam->sa_len > sizeof(struct sockaddr_un)) |
35 |
+ return (EINVAL); |
36 |
len = nam->sa_len - offsetof(struct sockaddr_un, sun_path); |
37 |
if (len <= 0) |
38 |
return (EINVAL); |
39 |
Index: sys/compat/linux/linux_socket.c |
40 |
=================================================================== |
41 |
--- sys/compat/linux/linux_socket.c (revision 225919) |
42 |
+++ sys/compat/linux/linux_socket.c (working copy) |
43 |
@@ -104,6 +104,7 @@ |
44 |
int oldv6size; |
45 |
struct sockaddr_in6 *sin6; |
46 |
#endif |
47 |
+ int namelen; |
48 |
|
49 |
if (*osalen < 2 || *osalen > UCHAR_MAX || !osa) |
50 |
return (EINVAL); |
51 |
@@ -166,6 +167,20 @@ |
52 |
} |
53 |
} |
54 |
|
55 |
+ if ((bdom == AF_LOCAL) && (*osalen > sizeof(struct sockaddr_un))) { |
56 |
+ for (namelen = 0; |
57 |
+ namelen < *osalen - offsetof(struct sockaddr_un, sun_path); |
58 |
+ namelen++) |
59 |
+ if (!((struct sockaddr_un *)kosa)->sun_path[namelen]) |
60 |
+ break; |
61 |
+ if (namelen + offsetof(struct sockaddr_un, sun_path) > |
62 |
+ sizeof(struct sockaddr_un)) { |
63 |
+ error = EINVAL; |
64 |
+ goto out; |
65 |
+ } |
66 |
+ alloclen = sizeof(struct sockaddr_un); |
67 |
+ } |
68 |
+ |
69 |
sa = (struct sockaddr *) kosa; |
70 |
sa->sa_family = bdom; |
71 |
sa->sa_len = alloclen; |