提交 099bd05f 编写于 作者: C Chuck Lever 提交者: Trond Myklebust

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: NChuck Lever <chuck.lever@oracle.com>
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 f34ec991
...@@ -149,6 +149,15 @@ nsm_create(void) ...@@ -149,6 +149,15 @@ nsm_create(void)
* XDR functions for NSM. * 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 * static __be32 *
xdr_encode_common(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp) xdr_encode_common(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册