autofs/autofs-5.0.6-fix-initialization-in-rpc-create_client.patch
Ian Kent 465c67deba * Wed May 16 2012 Ian Kent <ikent@redhat.com> - 1:5.0.6-17
- [abrt] autofs-5.0.6-16.fc17: clnt_dg_control:
  Process /usr/sbin/automount was killed by signal 11 (SIGSEGV)
  - fix initialization in rpc create_client() (bz821660).
2012-05-16 12:44:46 +08:00

41 lines
1.0 KiB
Diff

autofs-5.0.6 - fix initialization in rpc create_client()
From: Ian Kent <ikent@redhat.com>
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);