diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2009-06-02 14:18:20 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2009-06-02 14:18:20 +0000 |
commit | c5cc79a6c953de33884029842458f1d9b92196b2 (patch) | |
tree | 4243fc5e65403a4aefe3c04b09dc90ac4b4d3210 /lib | |
parent | 1d41b8ff804a2b5e20a574f438bdc97dbabbc3f7 (diff) |
When authnone_create fails, do not leave behind a NULL cl_auth attribute,
because that one will typically derefenced later without any checking.
Instead, flag the error condition and bail out cleanly.
useful feedback from kjell@ and ok millert@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/rpc/clnt_tcp.c | 9 | ||||
-rw-r--r-- | lib/libc/rpc/clnt_udp.c | 7 |
2 files changed, 13 insertions, 3 deletions
diff --git a/lib/libc/rpc/clnt_tcp.c b/lib/libc/rpc/clnt_tcp.c index ecda89715f0..8b6f78f9824 100644 --- a/lib/libc/rpc/clnt_tcp.c +++ b/lib/libc/rpc/clnt_tcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clnt_tcp.c,v 1.23 2006/03/31 18:28:55 deraadt Exp $ */ +/* $OpenBSD: clnt_tcp.c,v 1.24 2009/06/02 14:18:19 schwarze Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -181,7 +181,7 @@ clnttcp_create(struct sockaddr_in *raddr, u_long prog, u_long vers, int *sockp, call_msg.rm_call.cb_vers = vers; /* - * pre-serialize the staic part of the call msg and stash it away + * pre-serialize the static part of the call msg and stash it away */ xdrmem_create(&(ct->ct_xdrs), ct->ct_mcall, MCALL_MSG_SIZE, XDR_ENCODE); @@ -204,6 +204,11 @@ clnttcp_create(struct sockaddr_in *raddr, u_long prog, u_long vers, int *sockp, h->cl_ops = &tcp_ops; h->cl_private = (caddr_t) ct; h->cl_auth = authnone_create(); + if (h->cl_auth == NULL) { + rpc_createerr.cf_stat = RPC_SYSTEMERROR; + rpc_createerr.cf_error.re_errno = errno; + goto fooy; + } return (h); fooy: diff --git a/lib/libc/rpc/clnt_udp.c b/lib/libc/rpc/clnt_udp.c index 49a3ae43ae7..56dff22d713 100644 --- a/lib/libc/rpc/clnt_udp.c +++ b/lib/libc/rpc/clnt_udp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clnt_udp.c,v 1.24 2006/03/31 18:28:55 deraadt Exp $ */ +/* $OpenBSD: clnt_udp.c,v 1.25 2009/06/02 14:18:19 schwarze Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -175,6 +175,11 @@ clntudp_bufcreate(struct sockaddr_in *raddr, u_long program, u_long version, } cu->cu_sock = *sockp; cl->cl_auth = authnone_create(); + if (cl->cl_auth == NULL) { + rpc_createerr.cf_stat = RPC_SYSTEMERROR; + rpc_createerr.cf_error.re_errno = errno; + goto fooy; + } return (cl); fooy: if (cu) |