SUNRPC: Make sure server name is reasonable before trying to print it
Subsystems (3)
PATCH 4/15 SUNRPC: Make sure server name is reasonable before trying to print it
Check the length of the passed-in server name before trying to print it in the log.
Signed-off-by Chuck Lever <[email protected]>
---
net/sunrpc/clnt.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
net/sunrpc/clnt.c +8 -2
@@ -127,7 +127,14 @@ static struct rpc_clnt * rpc_new_client(struct rpc_xprt *xprt, char *servname, sstruct rpc_clnt *clnt =NULL ;struct rpc_auth *auth;int err; -int len; +size_t len; + +/* sanity check the name before trying to print it */ + err = -EINVAL ; + len =strlen (servname); +if (len >RPC_MAXNETNAMELEN ) + goto out_no_rpciod; + len++;dprintk ("RPC: creating %s client for %s (xprt %p)\n" , program->name, servname, xprt);
@@ -148,7 +155,6 @@ static struct rpc_clnt * rpc_new_client(struct rpc_xprt *xprt, char *servname, s clnt->cl_parent = clnt; clnt->cl_server = clnt->cl_inline_name; - len =strlen (servname) +1 ;if (len >sizeof (clnt->cl_inline_name)) {char *buf =kmalloc (len,GFP_KERNEL );if (buf !=0 )
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs