Skip to content

Commit a306c34

Browse files
J. Bruce Fieldsgregkh
authored andcommitted
SUNRPC: stop printk reading past end of string
[ Upstream commit 8c6b6c7 ] 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: Zhi Li <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]> Signed-off-by: Trond Myklebust <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 213fe77 commit a306c34

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/sunrpc/rpcb_clnt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,8 +975,8 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr,
975975
p = xdr_inline_decode(xdr, len);
976976
if (unlikely(p == NULL))
977977
goto out_fail;
978-
dprintk("RPC: %5u RPCB_%s reply: %s\n", req->rq_task->tk_pid,
979-
req->rq_task->tk_msg.rpc_proc->p_name, (char *)p);
978+
dprintk("RPC: %5u RPCB_%s reply: %*pE\n", req->rq_task->tk_pid,
979+
req->rq_task->tk_msg.rpc_proc->p_name, len, (char *)p);
980980

981981
if (rpc_uaddr2sockaddr(req->rq_xprt->xprt_net, (char *)p, len,
982982
sap, sizeof(address)) == 0)

0 commit comments

Comments
 (0)