autofs-5.0.6 - fix initialization in rpc create_client() From: Ian Kent Sometimes the RPC function create_client() function gets a non-null stack variable passed in which can cause a SEGV. Fix it by initializing the passed in variable. --- lib/rpc_subs.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c index f051e43..85796d1 100644 --- a/lib/rpc_subs.c +++ b/lib/rpc_subs.c @@ -316,6 +316,7 @@ static int create_client(struct conn_info *info, CLIENT **client) int fd, ret; fd = RPC_ANYSOCK; + *client = NULL; if (info->client) { if (!clnt_control(info->client, CLGET_FD, (char *) &fd)) { @@ -377,12 +378,13 @@ static int create_client(struct conn_info *info, CLIENT **client) freeaddrinfo(ai); +done: if (!*client) { info->client = NULL; ret = -ENOTCONN; goto out_close; } -done: + /* Close socket fd on destroy, as is default for rpcowned fds */ if (!clnt_control(*client, CLSET_FD_CLOSE, NULL)) { clnt_destroy(*client);