Skip to content

Commit

Permalink
SUNRPC: remove BUG_ON from encode_rpcb_string
Browse files Browse the repository at this point in the history
Replace BUG_ON() with WARN_ON_ONCE() and truncate the encoded string if
len > max.

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Weston Andros Adamson authored and Trond Myklebust committed Nov 4, 2012
1 parent b8a13d0 commit 332e008
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/sunrpc/rpcb_clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,10 @@ static void encode_rpcb_string(struct xdr_stream *xdr, const char *string,
u32 len;

len = strlen(string);
BUG_ON(len > maxstrlen);
WARN_ON_ONCE(len > maxstrlen);
if (len > maxstrlen)
/* truncate and hope for the best */
len = maxstrlen;
p = xdr_reserve_space(xdr, 4 + len);
xdr_encode_opaque(p, string, len);
}
Expand Down

0 comments on commit 332e008

Please sign in to comment.