Skip to content

Commit

Permalink
lockd: Ensure NSM strings aren't longer than protocol allows
Browse files Browse the repository at this point in the history
Introduce a special helper function to check the length of NSM strings
before they are placed on the wire.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Mar 19, 2008
1 parent f34ec99 commit 099bd05
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fs/lockd/mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ nsm_create(void)
* XDR functions for NSM.
*/

static __be32 *xdr_encode_nsm_string(__be32 *p, char *string)
{
size_t len = strlen(string);

if (len > SM_MAXSTRLEN)
len = SM_MAXSTRLEN;
return xdr_encode_opaque(p, string, len);
}

static __be32 *
xdr_encode_common(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
{
Expand Down

0 comments on commit 099bd05

Please sign in to comment.