diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2009-10-06 15:42:18 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-10-06 15:42:18 -0400 |
commit | f4373bf9e67e4a653c8854acd7b02dac9714c98a (patch) | |
tree | d0371ed7638c0939550a2a43aef5b384d2e96b48 /fs/nfs/client.c | |
parent | bcd2ea17da6a329a7276cde7286d802f009af332 (diff) | |
download | op-kernel-dev-f4373bf9e67e4a653c8854acd7b02dac9714c98a.zip op-kernel-dev-f4373bf9e67e4a653c8854acd7b02dac9714c98a.tar.gz |
nfs: Avoid overrun when copying client IP address string
As seen in <http://bugs.debian.org/549002>, nfs4_init_client() can
overrun the source string when copying the client IP address from
nfs_parsed_mount_data::client_address to nfs_client::cl_ipaddr. Since
these are both treated as null-terminated strings elsewhere, the copy
should be done with strlcpy() not memcpy().
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r-- | fs/nfs/client.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 63976c0..99ea196 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -1180,7 +1180,7 @@ static int nfs4_init_client(struct nfs_client *clp, 1, flags & NFS_MOUNT_NORESVPORT); if (error < 0) goto error; - memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr)); + strlcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr)); error = nfs_idmap_new(clp); if (error < 0) { |