1 |
commit: d968a5aa9ebfa6bc766bed99370e164f08b9a0dc |
2 |
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon May 8 18:33:08 2017 +0000 |
4 |
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon May 8 18:38:35 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d968a5aa |
7 |
|
8 |
net-libs/libtirpc: Revision bump to pull in patch for CVE-2017-8779 |
9 |
|
10 |
This also gets rid of the src_unpack definition, moves to src_prepare and |
11 |
adds a call to epatch_user to src_prepare. |
12 |
|
13 |
Gentoo-Bug: 617472 |
14 |
Package-Manager: Portage-2.3.5, Repoman-2.3.2 |
15 |
|
16 |
.../files/libtirpc-1.0.1-CVE-2017-8779.patch | 255 +++++++++++++++++++++ |
17 |
net-libs/libtirpc/libtirpc-1.0.1-r1.ebuild | 60 +++++ |
18 |
2 files changed, 315 insertions(+) |
19 |
|
20 |
diff --git a/net-libs/libtirpc/files/libtirpc-1.0.1-CVE-2017-8779.patch b/net-libs/libtirpc/files/libtirpc-1.0.1-CVE-2017-8779.patch |
21 |
new file mode 100644 |
22 |
index 00000000000..91a50fad649 |
23 |
--- /dev/null |
24 |
+++ b/net-libs/libtirpc/files/libtirpc-1.0.1-CVE-2017-8779.patch |
25 |
@@ -0,0 +1,255 @@ |
26 |
+diff --git a/src/rpc_generic.c b/src/rpc_generic.c |
27 |
+index 2f09a8f..589cbd5 100644 |
28 |
+--- a/src/rpc_generic.c |
29 |
++++ b/src/rpc_generic.c |
30 |
+@@ -615,6 +615,9 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf) |
31 |
+ |
32 |
+ switch (af) { |
33 |
+ case AF_INET: |
34 |
++ if (nbuf->len < sizeof(*sin)) { |
35 |
++ return NULL; |
36 |
++ } |
37 |
+ sin = nbuf->buf; |
38 |
+ if (inet_ntop(af, &sin->sin_addr, namebuf, sizeof namebuf) |
39 |
+ == NULL) |
40 |
+@@ -626,6 +629,9 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf) |
41 |
+ break; |
42 |
+ #ifdef INET6 |
43 |
+ case AF_INET6: |
44 |
++ if (nbuf->len < sizeof(*sin6)) { |
45 |
++ return NULL; |
46 |
++ } |
47 |
+ sin6 = nbuf->buf; |
48 |
+ if (inet_ntop(af, &sin6->sin6_addr, namebuf6, sizeof namebuf6) |
49 |
+ == NULL) |
50 |
+@@ -667,6 +673,8 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr) |
51 |
+ |
52 |
+ port = 0; |
53 |
+ sin = NULL; |
54 |
++ if (uaddr == NULL) |
55 |
++ return NULL; |
56 |
+ addrstr = strdup(uaddr); |
57 |
+ if (addrstr == NULL) |
58 |
+ return NULL; |
59 |
+diff --git a/src/rpcb_prot.c b/src/rpcb_prot.c |
60 |
+index 43fd385..a923c8e 100644 |
61 |
+--- a/src/rpcb_prot.c |
62 |
++++ b/src/rpcb_prot.c |
63 |
+@@ -41,6 +41,7 @@ |
64 |
+ #include <rpc/types.h> |
65 |
+ #include <rpc/xdr.h> |
66 |
+ #include <rpc/rpcb_prot.h> |
67 |
++#include "rpc_com.h" |
68 |
+ |
69 |
+ bool_t |
70 |
+ xdr_rpcb(xdrs, objp) |
71 |
+@@ -53,13 +54,13 @@ xdr_rpcb(xdrs, objp) |
72 |
+ if (!xdr_u_int32_t(xdrs, &objp->r_vers)) { |
73 |
+ return (FALSE); |
74 |
+ } |
75 |
+- if (!xdr_string(xdrs, &objp->r_netid, (u_int)~0)) { |
76 |
++ if (!xdr_string(xdrs, &objp->r_netid, RPC_MAXDATASIZE)) { |
77 |
+ return (FALSE); |
78 |
+ } |
79 |
+- if (!xdr_string(xdrs, &objp->r_addr, (u_int)~0)) { |
80 |
++ if (!xdr_string(xdrs, &objp->r_addr, RPC_MAXDATASIZE)) { |
81 |
+ return (FALSE); |
82 |
+ } |
83 |
+- if (!xdr_string(xdrs, &objp->r_owner, (u_int)~0)) { |
84 |
++ if (!xdr_string(xdrs, &objp->r_owner, RPC_MAXDATASIZE)) { |
85 |
+ return (FALSE); |
86 |
+ } |
87 |
+ return (TRUE); |
88 |
+@@ -159,19 +160,19 @@ xdr_rpcb_entry(xdrs, objp) |
89 |
+ XDR *xdrs; |
90 |
+ rpcb_entry *objp; |
91 |
+ { |
92 |
+- if (!xdr_string(xdrs, &objp->r_maddr, (u_int)~0)) { |
93 |
++ if (!xdr_string(xdrs, &objp->r_maddr, RPC_MAXDATASIZE)) { |
94 |
+ return (FALSE); |
95 |
+ } |
96 |
+- if (!xdr_string(xdrs, &objp->r_nc_netid, (u_int)~0)) { |
97 |
++ if (!xdr_string(xdrs, &objp->r_nc_netid, RPC_MAXDATASIZE)) { |
98 |
+ return (FALSE); |
99 |
+ } |
100 |
+ if (!xdr_u_int32_t(xdrs, &objp->r_nc_semantics)) { |
101 |
+ return (FALSE); |
102 |
+ } |
103 |
+- if (!xdr_string(xdrs, &objp->r_nc_protofmly, (u_int)~0)) { |
104 |
++ if (!xdr_string(xdrs, &objp->r_nc_protofmly, RPC_MAXDATASIZE)) { |
105 |
+ return (FALSE); |
106 |
+ } |
107 |
+- if (!xdr_string(xdrs, &objp->r_nc_proto, (u_int)~0)) { |
108 |
++ if (!xdr_string(xdrs, &objp->r_nc_proto, RPC_MAXDATASIZE)) { |
109 |
+ return (FALSE); |
110 |
+ } |
111 |
+ return (TRUE); |
112 |
+@@ -292,7 +293,7 @@ xdr_rpcb_rmtcallres(xdrs, p) |
113 |
+ bool_t dummy; |
114 |
+ struct r_rpcb_rmtcallres *objp = (struct r_rpcb_rmtcallres *)(void *)p; |
115 |
+ |
116 |
+- if (!xdr_string(xdrs, &objp->addr, (u_int)~0)) { |
117 |
++ if (!xdr_string(xdrs, &objp->addr, RPC_MAXDATASIZE)) { |
118 |
+ return (FALSE); |
119 |
+ } |
120 |
+ if (!xdr_u_int(xdrs, &objp->results.results_len)) { |
121 |
+@@ -312,6 +313,11 @@ xdr_netbuf(xdrs, objp) |
122 |
+ if (!xdr_u_int32_t(xdrs, (u_int32_t *) &objp->maxlen)) { |
123 |
+ return (FALSE); |
124 |
+ } |
125 |
++ |
126 |
++ if (objp->maxlen > RPC_MAXDATASIZE) { |
127 |
++ return (FALSE); |
128 |
++ } |
129 |
++ |
130 |
+ dummy = xdr_bytes(xdrs, (char **)&(objp->buf), |
131 |
+ (u_int *)&(objp->len), objp->maxlen); |
132 |
+ return (dummy); |
133 |
+diff --git a/src/rpcb_st_xdr.c b/src/rpcb_st_xdr.c |
134 |
+index 08db745..28e6a48 100644 |
135 |
+--- a/src/rpcb_st_xdr.c |
136 |
++++ b/src/rpcb_st_xdr.c |
137 |
+@@ -37,6 +37,7 @@ |
138 |
+ |
139 |
+ |
140 |
+ #include <rpc/rpc.h> |
141 |
++#include "rpc_com.h" |
142 |
+ |
143 |
+ /* Link list of all the stats about getport and getaddr */ |
144 |
+ |
145 |
+@@ -58,7 +59,7 @@ xdr_rpcbs_addrlist(xdrs, objp) |
146 |
+ if (!xdr_int(xdrs, &objp->failure)) { |
147 |
+ return (FALSE); |
148 |
+ } |
149 |
+- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { |
150 |
++ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) { |
151 |
+ return (FALSE); |
152 |
+ } |
153 |
+ |
154 |
+@@ -109,7 +110,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp) |
155 |
+ IXDR_PUT_INT32(buf, objp->failure); |
156 |
+ IXDR_PUT_INT32(buf, objp->indirect); |
157 |
+ } |
158 |
+- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { |
159 |
++ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) { |
160 |
+ return (FALSE); |
161 |
+ } |
162 |
+ if (!xdr_pointer(xdrs, (char **)&objp->next, |
163 |
+@@ -147,7 +148,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp) |
164 |
+ objp->failure = (int)IXDR_GET_INT32(buf); |
165 |
+ objp->indirect = (int)IXDR_GET_INT32(buf); |
166 |
+ } |
167 |
+- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { |
168 |
++ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) { |
169 |
+ return (FALSE); |
170 |
+ } |
171 |
+ if (!xdr_pointer(xdrs, (char **)&objp->next, |
172 |
+@@ -175,7 +176,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp) |
173 |
+ if (!xdr_int(xdrs, &objp->indirect)) { |
174 |
+ return (FALSE); |
175 |
+ } |
176 |
+- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { |
177 |
++ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) { |
178 |
+ return (FALSE); |
179 |
+ } |
180 |
+ if (!xdr_pointer(xdrs, (char **)&objp->next, |
181 |
+diff --git a/src/xdr.c b/src/xdr.c |
182 |
+index f3fb9ad..b9a1558 100644 |
183 |
+--- a/src/xdr.c |
184 |
++++ b/src/xdr.c |
185 |
+@@ -42,8 +42,10 @@ |
186 |
+ #include <stdlib.h> |
187 |
+ #include <string.h> |
188 |
+ |
189 |
++#include <rpc/rpc.h> |
190 |
+ #include <rpc/types.h> |
191 |
+ #include <rpc/xdr.h> |
192 |
++#include <rpc/rpc_com.h> |
193 |
+ |
194 |
+ typedef quad_t longlong_t; /* ANSI long long type */ |
195 |
+ typedef u_quad_t u_longlong_t; /* ANSI unsigned long long type */ |
196 |
+@@ -53,7 +55,6 @@ typedef u_quad_t u_longlong_t; /* ANSI unsigned long long type */ |
197 |
+ */ |
198 |
+ #define XDR_FALSE ((long) 0) |
199 |
+ #define XDR_TRUE ((long) 1) |
200 |
+-#define LASTUNSIGNED ((u_int) 0-1) |
201 |
+ |
202 |
+ /* |
203 |
+ * for unit alignment |
204 |
+@@ -629,6 +630,7 @@ xdr_bytes(xdrs, cpp, sizep, maxsize) |
205 |
+ { |
206 |
+ char *sp = *cpp; /* sp is the actual string pointer */ |
207 |
+ u_int nodesize; |
208 |
++ bool_t ret, allocated = FALSE; |
209 |
+ |
210 |
+ /* |
211 |
+ * first deal with the length since xdr bytes are counted |
212 |
+@@ -652,6 +654,7 @@ xdr_bytes(xdrs, cpp, sizep, maxsize) |
213 |
+ } |
214 |
+ if (sp == NULL) { |
215 |
+ *cpp = sp = mem_alloc(nodesize); |
216 |
++ allocated = TRUE; |
217 |
+ } |
218 |
+ if (sp == NULL) { |
219 |
+ warnx("xdr_bytes: out of memory"); |
220 |
+@@ -660,7 +663,14 @@ xdr_bytes(xdrs, cpp, sizep, maxsize) |
221 |
+ /* FALLTHROUGH */ |
222 |
+ |
223 |
+ case XDR_ENCODE: |
224 |
+- return (xdr_opaque(xdrs, sp, nodesize)); |
225 |
++ ret = xdr_opaque(xdrs, sp, nodesize); |
226 |
++ if ((xdrs->x_op == XDR_DECODE) && (ret == FALSE)) { |
227 |
++ if (allocated == TRUE) { |
228 |
++ free(sp); |
229 |
++ *cpp = NULL; |
230 |
++ } |
231 |
++ } |
232 |
++ return (ret); |
233 |
+ |
234 |
+ case XDR_FREE: |
235 |
+ if (sp != NULL) { |
236 |
+@@ -754,6 +764,7 @@ xdr_string(xdrs, cpp, maxsize) |
237 |
+ char *sp = *cpp; /* sp is the actual string pointer */ |
238 |
+ u_int size; |
239 |
+ u_int nodesize; |
240 |
++ bool_t ret, allocated = FALSE; |
241 |
+ |
242 |
+ /* |
243 |
+ * first deal with the length since xdr strings are counted-strings |
244 |
+@@ -793,8 +804,10 @@ xdr_string(xdrs, cpp, maxsize) |
245 |
+ switch (xdrs->x_op) { |
246 |
+ |
247 |
+ case XDR_DECODE: |
248 |
+- if (sp == NULL) |
249 |
++ if (sp == NULL) { |
250 |
+ *cpp = sp = mem_alloc(nodesize); |
251 |
++ allocated = TRUE; |
252 |
++ } |
253 |
+ if (sp == NULL) { |
254 |
+ warnx("xdr_string: out of memory"); |
255 |
+ return (FALSE); |
256 |
+@@ -803,7 +816,14 @@ xdr_string(xdrs, cpp, maxsize) |
257 |
+ /* FALLTHROUGH */ |
258 |
+ |
259 |
+ case XDR_ENCODE: |
260 |
+- return (xdr_opaque(xdrs, sp, size)); |
261 |
++ ret = xdr_opaque(xdrs, sp, size); |
262 |
++ if ((xdrs->x_op == XDR_DECODE) && (ret == FALSE)) { |
263 |
++ if (allocated == TRUE) { |
264 |
++ free(sp); |
265 |
++ *cpp = NULL; |
266 |
++ } |
267 |
++ } |
268 |
++ return (ret); |
269 |
+ |
270 |
+ case XDR_FREE: |
271 |
+ mem_free(sp, nodesize); |
272 |
+@@ -823,7 +843,7 @@ xdr_wrapstring(xdrs, cpp) |
273 |
+ XDR *xdrs; |
274 |
+ char **cpp; |
275 |
+ { |
276 |
+- return xdr_string(xdrs, cpp, LASTUNSIGNED); |
277 |
++ return xdr_string(xdrs, cpp, RPC_MAXDATASIZE); |
278 |
+ } |
279 |
+ |
280 |
+ /* |
281 |
|
282 |
diff --git a/net-libs/libtirpc/libtirpc-1.0.1-r1.ebuild b/net-libs/libtirpc/libtirpc-1.0.1-r1.ebuild |
283 |
new file mode 100644 |
284 |
index 00000000000..7356481b169 |
285 |
--- /dev/null |
286 |
+++ b/net-libs/libtirpc/libtirpc-1.0.1-r1.ebuild |
287 |
@@ -0,0 +1,60 @@ |
288 |
+# Copyright 1999-2017 Gentoo Foundation |
289 |
+# Distributed under the terms of the GNU General Public License v2 |
290 |
+ |
291 |
+EAPI="5" |
292 |
+ |
293 |
+inherit multilib-minimal toolchain-funcs eutils |
294 |
+ |
295 |
+DESCRIPTION="Transport Independent RPC library (SunRPC replacement)" |
296 |
+HOMEPAGE="http://libtirpc.sourceforge.net/" |
297 |
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2 |
298 |
+ mirror://gentoo/${PN}-glibc-nfs.tar.xz" |
299 |
+ |
300 |
+LICENSE="GPL-2" |
301 |
+SLOT="0/3" # subslot matches SONAME major |
302 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" |
303 |
+IUSE="ipv6 kerberos static-libs" |
304 |
+ |
305 |
+RDEPEND="kerberos? ( >=virtual/krb5-0-r1[${MULTILIB_USEDEP}] )" |
306 |
+DEPEND="${RDEPEND} |
307 |
+ app-arch/xz-utils |
308 |
+ >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]" |
309 |
+ |
310 |
+PATCHES=( |
311 |
+ "${FILESDIR}/${P}-CVE-2017-8779.patch" |
312 |
+) |
313 |
+ |
314 |
+src_prepare() { |
315 |
+ cp -r "${WORKDIR}"/tirpc "${S}"/ || die |
316 |
+ epatch "${PATCHES[@]}" |
317 |
+ epatch_user |
318 |
+} |
319 |
+ |
320 |
+multilib_src_configure() { |
321 |
+ ECONF_SOURCE=${S} \ |
322 |
+ econf \ |
323 |
+ $(use_enable ipv6) \ |
324 |
+ $(use_enable kerberos gssapi) \ |
325 |
+ $(use_enable static-libs static) |
326 |
+} |
327 |
+ |
328 |
+multilib_src_install() { |
329 |
+ default |
330 |
+ |
331 |
+ # libtirpc replaces rpc support in glibc, so we need it in / |
332 |
+ gen_usr_ldscript -a tirpc |
333 |
+} |
334 |
+ |
335 |
+multilib_src_install_all() { |
336 |
+ einstalldocs |
337 |
+ |
338 |
+ insinto /etc |
339 |
+ doins doc/netconfig |
340 |
+ |
341 |
+ insinto /usr/include/tirpc |
342 |
+ doins -r "${WORKDIR}"/tirpc/* |
343 |
+ |
344 |
+ # makes sure that the linking order for nfs-utils is proper, as |
345 |
+ # libtool would inject a libgssglue dependency in the list. |
346 |
+ use static-libs || prune_libtool_files |
347 |
+} |