File clntudp-call-use-after-free.patch of Package glibc.6721

2017-02-27  Florian Weimer  <fweimer@redhat.com>

	[BZ #21115]
	* sunrpc/clnt_udp.c (clntudp_call): Free ancillary data later.

Index: glibc-2.22/sunrpc/clnt_udp.c
===================================================================
--- glibc-2.22.orig/sunrpc/clnt_udp.c
+++ glibc-2.22/sunrpc/clnt_udp.c
@@ -456,9 +456,9 @@ send_again:
 		 cmsg = CMSG_NXTHDR (&msg, cmsg))
 	      if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR)
 		{
-		  free (cbuf);
 		  e = (struct sock_extended_err *) CMSG_DATA(cmsg);
 		  cu->cu_error.re_errno = e->ee_errno;
+		  free (cbuf);
 		  return (cu->cu_error.re_status = RPC_CANTRECV);
 		}
 	  free (cbuf);
openSUSE Build Service is sponsored by