summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-09-22 18:42:05 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-09-22 18:42:05 +0000
commitd18267fdcf69320a8929dd06de2610e29bbb2b75 (patch)
tree16968a101a0f9ee554fd4de98031ebe94f167151 /lib/libc
parenta99c1651ff77bda8561ed4b0dd429b244ab8c5ec (diff)
Check return value of authunix_create_default(); from bret lambert
with some guidance by me; ok jaredy@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/rpc/pmap_rmt.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/libc/rpc/pmap_rmt.c b/lib/libc/rpc/pmap_rmt.c
index 1356b3fd15a..76adaddd2a3 100644
--- a/lib/libc/rpc/pmap_rmt.c
+++ b/lib/libc/rpc/pmap_rmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap_rmt.c,v 1.26 2006/03/31 17:31:59 deraadt Exp $ */
+/* $OpenBSD: pmap_rmt.c,v 1.27 2006/09/22 18:42:04 otto 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
@@ -208,7 +208,7 @@ clnt_broadcast(u_long prog, /* program number */
resultproc_t eachresult) /* call with each result obtained */
{
enum clnt_stat stat;
- AUTH *unix_auth = authunix_create_default();
+ AUTH *unix_auth;
XDR xdr_stream;
XDR *xdrs = &xdr_stream;
int outlen, inlen, nets;
@@ -228,6 +228,11 @@ clnt_broadcast(u_long prog, /* program number */
struct rpc_msg msg;
char outbuf[MAX_BROADCAST_SIZE], inbuf[UDPMSGSIZE];
+ if ((unix_auth = authunix_create_default()) == NULL) {
+ stat = RPC_AUTHERROR;
+ goto done_broad;
+ }
+
/*
* initialization: create a socket, a broadcast address, and
* preserialize the arguments into a send buffer.
@@ -371,6 +376,7 @@ done_broad:
free(addrs);
if (sock >= 0)
(void)close(sock);
- AUTH_DESTROY(unix_auth);
+ if (unix_auth != NULL)
+ AUTH_DESTROY(unix_auth);
return (stat);
}