Commit a306c34f authored by J. Bruce Fields's avatar J. Bruce Fields Committed by Greg Kroah-Hartman

SUNRPC: stop printk reading past end of string

[ Upstream commit 8c6b6c79 ]

Since p points at raw xdr data, there's no guarantee that it's NULL
terminated, so we should give a length.  And probably escape any special
characters too.
Reported-by: default avatarZhi Li <yieli@redhat.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 213fe774
......@@ -975,8 +975,8 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr,
p = xdr_inline_decode(xdr, len);
if (unlikely(p == NULL))
goto out_fail;
dprintk("RPC: %5u RPCB_%s reply: %s\n", req->rq_task->tk_pid,
req->rq_task->tk_msg.rpc_proc->p_name, (char *)p);
dprintk("RPC: %5u RPCB_%s reply: %*pE\n", req->rq_task->tk_pid,
req->rq_task->tk_msg.rpc_proc->p_name, len, (char *)p);
if (rpc_uaddr2sockaddr(req->rq_xprt->xprt_net, (char *)p, len,
sap, sizeof(address)) == 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment