Blame SOURCES/libtirpc-0.2.4-covscan.patch

17585d
diff -up libtirpc-0.2.4/src/auth_gss.c.orig libtirpc-0.2.4/src/auth_gss.c
17585d
--- libtirpc-0.2.4/src/auth_gss.c.orig	2017-05-25 09:53:19.659862958 -0400
17585d
+++ libtirpc-0.2.4/src/auth_gss.c	2018-09-11 13:16:34.644008111 -0400
17585d
@@ -176,6 +176,7 @@ authgss_create(CLIENT *clnt, gss_name_t
17585d
 			rpc_createerr.cf_stat = RPC_SYSTEMERROR;
17585d
 			rpc_createerr.cf_error.re_errno = ENOMEM;
17585d
 			free(auth);
17585d
+			free(gd);
17585d
 			return (NULL);
17585d
 		}
17585d
 	}
17585d
diff -up libtirpc-0.2.4/src/clnt_bcast.c.orig libtirpc-0.2.4/src/clnt_bcast.c
17585d
--- libtirpc-0.2.4/src/clnt_bcast.c.orig	2017-05-25 09:53:19.659862958 -0400
17585d
+++ libtirpc-0.2.4/src/clnt_bcast.c	2018-09-11 13:16:34.644008111 -0400
17585d
@@ -297,6 +297,7 @@ rpc_broadcast_exp(prog, vers, proc, xarg
17585d
 	if (nettype == NULL)
17585d
 		nettype = "datagram_n";
17585d
 	if ((handle = __rpc_setconf(nettype)) == NULL) {
17585d
+		AUTH_DESTROY(sys_auth);
17585d
 		return (RPC_UNKNOWNPROTO);
17585d
 	}
17585d
 	while ((nconf = __rpc_getconf(handle)) != NULL) {
17585d
diff -up libtirpc-0.2.4/src/getnetconfig.c.orig libtirpc-0.2.4/src/getnetconfig.c
17585d
--- libtirpc-0.2.4/src/getnetconfig.c.orig	2013-12-09 15:59:51.000000000 -0500
17585d
+++ libtirpc-0.2.4/src/getnetconfig.c	2018-09-11 13:16:34.644008111 -0400
17585d
@@ -710,6 +710,8 @@ struct netconfig	*ncp;
17585d
     p->nc_lookups = (char **)malloc((size_t)(p->nc_nlookups+1) * sizeof(char *));
17585d
     if (p->nc_lookups == NULL) {
17585d
 	free(p->nc_netid);
17585d
+	free(p);
17585d
+	free(tmp);
17585d
 	return(NULL);
17585d
     }
17585d
     for (i=0; i < p->nc_nlookups; i++) {
17585d
diff -up libtirpc-0.2.4/src/getnetpath.c.orig libtirpc-0.2.4/src/getnetpath.c
17585d
--- libtirpc-0.2.4/src/getnetpath.c.orig	2013-12-09 15:59:51.000000000 -0500
17585d
+++ libtirpc-0.2.4/src/getnetpath.c	2018-09-11 13:16:34.645008107 -0400
17585d
@@ -90,6 +90,7 @@ setnetpath()
17585d
     }
17585d
     if ((np_sessionp->nc_handlep = setnetconfig()) == NULL) {
17585d
 	syslog (LOG_ERR, "rpc: failed to open " NETCONFIG);
17585d
+	free(np_sessionp);
17585d
 	return (NULL);
17585d
     }
17585d
     np_sessionp->valid = NP_VALID;
17585d
diff -up libtirpc-0.2.4/src/rpcb_clnt.c.orig libtirpc-0.2.4/src/rpcb_clnt.c
17585d
--- libtirpc-0.2.4/src/rpcb_clnt.c.orig	2017-05-25 09:53:19.660862942 -0400
17585d
+++ libtirpc-0.2.4/src/rpcb_clnt.c	2018-09-11 13:16:34.645008107 -0400
17585d
@@ -493,6 +493,7 @@ try_nconf:
17585d
 		if (tmpnconf == NULL) {
17585d
  			rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
17585d
 			mutex_unlock(&loopnconf_lock);
17585d
+			endnetconfig(nc_handle);
17585d
 			return (NULL);
17585d
 		}
17585d
 		loopnconf = getnetconfigent(tmpnconf->nc_netid);
17585d
diff -up libtirpc-0.2.4/src/rpc_generic.c.orig libtirpc-0.2.4/src/rpc_generic.c
17585d
--- libtirpc-0.2.4/src/rpc_generic.c.orig	2017-05-25 09:53:19.669862794 -0400
17585d
+++ libtirpc-0.2.4/src/rpc_generic.c	2018-09-11 13:16:34.645008107 -0400
17585d
@@ -320,6 +320,7 @@ __rpc_setconf(nettype)
17585d
 		handle->nflag = FALSE;
17585d
 		break;
17585d
 	default:
17585d
+		free(handle);
17585d
 		return (NULL);
17585d
 	}
17585d
 
17585d
diff -up libtirpc-0.2.4/src/rpc_soc.c.orig libtirpc-0.2.4/src/rpc_soc.c
17585d
--- libtirpc-0.2.4/src/rpc_soc.c.orig	2013-12-09 15:59:51.000000000 -0500
17585d
+++ libtirpc-0.2.4/src/rpc_soc.c	2018-09-11 13:16:34.645008107 -0400
17585d
@@ -627,15 +627,17 @@ svcunix_create(sock, sendsize, recvsize,
17585d
 		    strcmp(nconf->nc_protofmly, NC_LOOPBACK) == 0)
17585d
 			break;
17585d
 	}
17585d
-	if (nconf == NULL)
17585d
+	if (nconf == NULL) {
17585d
+		endnetconfig(localhandle);
17585d
 		return(xprt);
17585d
+	}
17585d
 
17585d
 	if ((sock = __rpc_nconf2fd(nconf)) < 0)
17585d
 		goto done;
17585d
 
17585d
 	memset(&sun, 0, sizeof sun);
17585d
 	sun.sun_family = AF_LOCAL;
17585d
-	strncpy(sun.sun_path, path, sizeof(sun.sun_path));
17585d
+	strncpy(sun.sun_path, path, (sizeof(sun.sun_path)-1));
17585d
 	addrlen = sizeof(struct sockaddr_un);
17585d
 	sa = (struct sockaddr *)&sun;
17585d
 
17585d
@@ -656,6 +658,8 @@ svcunix_create(sock, sendsize, recvsize,
17585d
 	}
17585d
 
17585d
 	xprt = (SVCXPRT *)svc_tli_create(sock, nconf, &taddr, sendsize, recvsize);
17585d
+	if (xprt == NULL)
17585d
+		close(sock);
17585d
 
17585d
 done:
17585d
 	endnetconfig(localhandle);
17585d
diff -up libtirpc-0.2.4/src/rtime.c.orig libtirpc-0.2.4/src/rtime.c
17585d
--- libtirpc-0.2.4/src/rtime.c.orig	2017-05-25 09:53:19.667862827 -0400
17585d
+++ libtirpc-0.2.4/src/rtime.c	2018-09-11 13:16:34.645008107 -0400
17585d
@@ -90,6 +90,7 @@ rtime(addrp, timep, timeout)
17585d
 
17585d
 	/* TCP and UDP port are the same in this case */
17585d
 	if ((serv = getservbyname("time", "tcp")) == NULL) {
17585d
+		do_close(s);
17585d
 		return(-1);
17585d
 	}
17585d
 
17585d
diff -up libtirpc-0.2.4/src/svc_generic.c.orig libtirpc-0.2.4/src/svc_generic.c
17585d
--- libtirpc-0.2.4/src/svc_generic.c.orig	2017-05-25 09:53:19.657862991 -0400
17585d
+++ libtirpc-0.2.4/src/svc_generic.c	2018-09-11 13:16:34.645008107 -0400
17585d
@@ -112,6 +112,7 @@ svc_create(dispatch, prognum, versnum, n
17585d
 				if (l == NULL) {
17585d
 					warnx("svc_create: no memory");
17585d
 					mutex_unlock(&xprtlist_lock);
17585d
+					__rpc_endconf(handle);
17585d
 					return (0);
17585d
 				}
17585d
 				l->xprt = xprt;
17585d
diff -up libtirpc-0.2.4/src/svc_simple.c.orig libtirpc-0.2.4/src/svc_simple.c
17585d
--- libtirpc-0.2.4/src/svc_simple.c.orig	2013-12-09 15:59:51.000000000 -0500
17585d
+++ libtirpc-0.2.4/src/svc_simple.c	2018-09-11 13:16:34.646008103 -0400
17585d
@@ -158,6 +158,7 @@ rpc_reg(prognum, versnum, procnum, progn
17585d
 				((netid = strdup(nconf->nc_netid)) == NULL)) {
17585d
 				warnx(rpc_reg_err, rpc_reg_msg, __no_mem_str);
17585d
 				SVC_DESTROY(svcxprt);
17585d
+				free(xdrbuf);
17585d
 				break;
17585d
 			}
17585d
 			madenow = TRUE;
17585d
diff -up libtirpc-0.2.4/src/xdr.c.orig libtirpc-0.2.4/src/xdr.c
17585d
--- libtirpc-0.2.4/src/xdr.c.orig	2017-05-25 09:53:19.669862794 -0400
17585d
+++ libtirpc-0.2.4/src/xdr.c	2017-05-25 11:50:19.154648294 -0400
17585d
@@ -636,9 +636,11 @@ xdr_bytes(xdrs, cpp, sizep, maxsize)
17585d
 	/*
17585d
 	 * first deal with the length since xdr bytes are counted
17585d
 	 */
17585d
+	
17585d
 	if (! xdr_u_int(xdrs, sizep)) {
17585d
 		return (FALSE);
17585d
 	}
17585d
+
17585d
 	nodesize = *sizep;
17585d
 	if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) {
17585d
 		return (FALSE);