diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2008-03-14 14:25:32 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-03-19 18:00:54 -0400 |
commit | 099bd05f27ff24a3041d54e7ed42d2eb681484b9 (patch) | |
tree | beb5738bdce698874255eb890f84a770a83d34e5 | |
parent | f34ec991ae0f015f5cdc51ad46c3a317ffae2466 (diff) |
lockd: Ensure NSM strings aren't longer than protocol allows
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>
-rw-r--r-- | fs/lockd/mon.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index 908b23fadd05..84fd84cb67b7 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c | |||
@@ -149,6 +149,15 @@ nsm_create(void) | |||
149 | * XDR functions for NSM. | 149 | * XDR functions for NSM. |
150 | */ | 150 | */ |
151 | 151 | ||
152 | static __be32 *xdr_encode_nsm_string(__be32 *p, char *string) | ||
153 | { | ||
154 | size_t len = strlen(string); | ||
155 | |||
156 | if (len > SM_MAXSTRLEN) | ||
157 | len = SM_MAXSTRLEN; | ||
158 | return xdr_encode_opaque(p, string, len); | ||
159 | } | ||
160 | |||
152 | static __be32 * | 161 | static __be32 * |
153 | xdr_encode_common(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp) | 162 | xdr_encode_common(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp) |
154 | { | 163 | { |