提交 350c73af 编写于 作者: C Chuck Lever 提交者: Trond Myklebust

NFS: Off-by-one length error in string handling

The hostname was getting truncated in the new text-based NFS mount API.
Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 fdc6e2c8
...@@ -1153,7 +1153,7 @@ static int nfs_validate_mount_data(struct nfs_mount_data **options, ...@@ -1153,7 +1153,7 @@ static int nfs_validate_mount_data(struct nfs_mount_data **options,
c = strchr(dev_name, ':'); c = strchr(dev_name, ':');
if (c == NULL) if (c == NULL)
return -EINVAL; return -EINVAL;
len = c - dev_name - 1; len = c - dev_name;
if (len > sizeof(data->hostname)) if (len > sizeof(data->hostname))
return -EINVAL; return -EINVAL;
strncpy(data->hostname, dev_name, len); strncpy(data->hostname, dev_name, len);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册