Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Feb 2020 16:18:27 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r358122 - stable/11/lib/libc/rpc
Message-ID:  <202002191618.01JGIRcq052417@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Feb 19 16:18:27 2020
New Revision: 358122
URL: https://svnweb.freebsd.org/changeset/base/358122

Log:
  MFC r357576:
  Fix a use of an uninitialized pointer in xdr_rpcbs_rmtcalllist().
  
  PR:	243759

Modified:
  stable/11/lib/libc/rpc/rpcb_st_xdr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/rpc/rpcb_st_xdr.c
==============================================================================
--- stable/11/lib/libc/rpc/rpcb_st_xdr.c	Wed Feb 19 16:17:51 2020	(r358121)
+++ stable/11/lib/libc/rpc/rpcb_st_xdr.c	Wed Feb 19 16:18:27 2020	(r358122)
@@ -52,29 +52,28 @@ xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp)
 {
 	struct rpcbs_addrlist **pnext;
 
-	    if (!xdr_rpcprog(xdrs, &objp->prog)) {
+	if (!xdr_rpcprog(xdrs, &objp->prog)) {
 		return (FALSE);
-	    }
-	    if (!xdr_rpcvers(xdrs, &objp->vers)) {
+	}
+	if (!xdr_rpcvers(xdrs, &objp->vers)) {
 		return (FALSE);
-	    }
-	    if (!xdr_int(xdrs, &objp->success)) {
+	}
+	if (!xdr_int(xdrs, &objp->success)) {
 		return (FALSE);
-	    }
-	    if (!xdr_int(xdrs, &objp->failure)) {
+	}
+	if (!xdr_int(xdrs, &objp->failure)) {
 		return (FALSE);
-	    }
-	    if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
+	}
+	if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
 		return (FALSE);
-	    }
+	}
 
-	    pnext = &objp->next;
-
-	    if (!xdr_pointer(xdrs, (char **) pnext,
+	pnext = &objp->next;
+	if (!xdr_pointer(xdrs, (char **) pnext,
 			sizeof (rpcbs_addrlist),
 			(xdrproc_t)xdr_rpcbs_addrlist)) {
 		return (FALSE);
-	    }
+	}
 
 	return (TRUE);
 }
@@ -84,86 +83,86 @@ xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp)
 bool_t
 xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_rmtcalllist *objp)
 {
-	int32_t *buf;
 	struct rpcbs_rmtcalllist **pnext;
+	int32_t *buf;
 
+	pnext = &objp->next;
 	if (xdrs->x_op == XDR_ENCODE) {
-	buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
-	if (buf == NULL) {
-		if (!xdr_rpcprog(xdrs, &objp->prog)) {
-			return (FALSE);
+		buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
+		if (buf == NULL) {
+			if (!xdr_rpcprog(xdrs, &objp->prog)) {
+				return (FALSE);
+			}
+			if (!xdr_rpcvers(xdrs, &objp->vers)) {
+				return (FALSE);
+			}
+			if (!xdr_rpcproc(xdrs, &objp->proc)) {
+				return (FALSE);
+			}
+			if (!xdr_int(xdrs, &objp->success)) {
+				return (FALSE);
+			}
+			if (!xdr_int(xdrs, &objp->failure)) {
+				return (FALSE);
+			}
+			if (!xdr_int(xdrs, &objp->indirect)) {
+				return (FALSE);
+			}
+		} else {
+			IXDR_PUT_U_INT32(buf, objp->prog);
+			IXDR_PUT_U_INT32(buf, objp->vers);
+			IXDR_PUT_U_INT32(buf, objp->proc);
+			IXDR_PUT_INT32(buf, objp->success);
+			IXDR_PUT_INT32(buf, objp->failure);
+			IXDR_PUT_INT32(buf, objp->indirect);
 		}
-		if (!xdr_rpcvers(xdrs, &objp->vers)) {
+		if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
 			return (FALSE);
 		}
-		if (!xdr_rpcproc(xdrs, &objp->proc)) {
+		if (!xdr_pointer(xdrs, (char **) pnext,
+				sizeof (rpcbs_rmtcalllist),
+				(xdrproc_t)xdr_rpcbs_rmtcalllist)) {
 			return (FALSE);
 		}
-		if (!xdr_int(xdrs, &objp->success)) {
-			return (FALSE);
-		}
-		if (!xdr_int(xdrs, &objp->failure)) {
-			return (FALSE);
-		}
-		if (!xdr_int(xdrs, &objp->indirect)) {
-			return (FALSE);
-		}
-	} else {
-		IXDR_PUT_U_INT32(buf, objp->prog);
-		IXDR_PUT_U_INT32(buf, objp->vers);
-		IXDR_PUT_U_INT32(buf, objp->proc);
-		IXDR_PUT_INT32(buf, objp->success);
-		IXDR_PUT_INT32(buf, objp->failure);
-		IXDR_PUT_INT32(buf, objp->indirect);
-	}
-	if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
-		return (FALSE);
-	}
-	pnext = &objp->next;
-	if (!xdr_pointer(xdrs, (char **) pnext,
-			sizeof (rpcbs_rmtcalllist),
-			(xdrproc_t)xdr_rpcbs_rmtcalllist)) {
-		return (FALSE);
-	}
-	return (TRUE);
+		return (TRUE);
 	} else if (xdrs->x_op == XDR_DECODE) {
-	buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
-	if (buf == NULL) {
-		if (!xdr_rpcprog(xdrs, &objp->prog)) {
-			return (FALSE);
+		buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
+		if (buf == NULL) {
+			if (!xdr_rpcprog(xdrs, &objp->prog)) {
+				return (FALSE);
+			}
+			if (!xdr_rpcvers(xdrs, &objp->vers)) {
+				return (FALSE);
+			}
+			if (!xdr_rpcproc(xdrs, &objp->proc)) {
+				return (FALSE);
+			}
+			if (!xdr_int(xdrs, &objp->success)) {
+				return (FALSE);
+			}
+			if (!xdr_int(xdrs, &objp->failure)) {
+				return (FALSE);
+			}
+			if (!xdr_int(xdrs, &objp->indirect)) {
+				return (FALSE);
+			}
+		} else {
+			objp->prog = (rpcprog_t)IXDR_GET_U_INT32(buf);
+			objp->vers = (rpcvers_t)IXDR_GET_U_INT32(buf);
+			objp->proc = (rpcproc_t)IXDR_GET_U_INT32(buf);
+			objp->success = (int)IXDR_GET_INT32(buf);
+			objp->failure = (int)IXDR_GET_INT32(buf);
+			objp->indirect = (int)IXDR_GET_INT32(buf);
 		}
-		if (!xdr_rpcvers(xdrs, &objp->vers)) {
+		if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
 			return (FALSE);
 		}
-		if (!xdr_rpcproc(xdrs, &objp->proc)) {
+		if (!xdr_pointer(xdrs, (char **) pnext,
+				sizeof (rpcbs_rmtcalllist),
+				(xdrproc_t)xdr_rpcbs_rmtcalllist)) {
 			return (FALSE);
 		}
-		if (!xdr_int(xdrs, &objp->success)) {
-			return (FALSE);
-		}
-		if (!xdr_int(xdrs, &objp->failure)) {
-			return (FALSE);
-		}
-		if (!xdr_int(xdrs, &objp->indirect)) {
-			return (FALSE);
-		}
-	} else {
-		objp->prog = (rpcprog_t)IXDR_GET_U_INT32(buf);
-		objp->vers = (rpcvers_t)IXDR_GET_U_INT32(buf);
-		objp->proc = (rpcproc_t)IXDR_GET_U_INT32(buf);
-		objp->success = (int)IXDR_GET_INT32(buf);
-		objp->failure = (int)IXDR_GET_INT32(buf);
-		objp->indirect = (int)IXDR_GET_INT32(buf);
-	}
-	if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
-		return (FALSE);
-	}
-	if (!xdr_pointer(xdrs, (char **) pnext,
-			sizeof (rpcbs_rmtcalllist),
-			(xdrproc_t)xdr_rpcbs_rmtcalllist)) {
-		return (FALSE);
-	}
-	return (TRUE);
+		return (TRUE);
 	}
 	if (!xdr_rpcprog(xdrs, &objp->prog)) {
 		return (FALSE);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002191618.01JGIRcq052417>