Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Feb 2020 16:17:51 +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-12@freebsd.org
Subject:   svn commit: r358121 - stable/12/lib/libc/rpc
Message-ID:  <202002191617.01JGHpfI052327@repo.freebsd.org>

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

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

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

Modified: stable/12/lib/libc/rpc/rpcb_st_xdr.c
==============================================================================
--- stable/12/lib/libc/rpc/rpcb_st_xdr.c	Wed Feb 19 15:56:40 2020	(r358120)
+++ stable/12/lib/libc/rpc/rpcb_st_xdr.c	Wed Feb 19 16:17:51 2020	(r358121)
@@ -54,29 +54,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);
 }
@@ -86,86 +85,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?202002191617.01JGHpfI052327>