Commit 55a6efb3 authored by Ben Hutchings's avatar Ben Hutchings Committed by Greg Kroah-Hartman

nfs: Avoid overrun when copying client IP address string

commit f4373bf9 upstream.

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: default avatarBen Hutchings <ben@decadent.org.uk>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cd45ad45
...@@ -1171,7 +1171,7 @@ static int nfs4_init_client(struct nfs_client *clp, ...@@ -1171,7 +1171,7 @@ static int nfs4_init_client(struct nfs_client *clp,
1, flags & NFS_MOUNT_NORESVPORT); 1, flags & NFS_MOUNT_NORESVPORT);
if (error < 0) if (error < 0)
goto error; 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); error = nfs_idmap_new(clp);
if (error < 0) { if (error < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment