aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2009-10-06 15:42:18 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-11-09 16:52:36 -0800
commitecb50328c9d53fb06a01734a12ce70748747feac (patch)
treeeed54302e046066b36fc3b0fdfb0f4a55f0a6794 /fs
parentb5d2222fa553a000577326fd2ea65d401f4ac000 (diff)
nfs: Avoid overrun when copying client IP address string
commit f4373bf9e67e4a653c8854acd7b02dac9714c98a 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: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/client.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 5ee23e7058b..9d6a0e4a751 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -983,7 +983,7 @@ static int nfs4_init_client(struct nfs_client *clp,
RPC_CLNT_CREATE_DISCRTRY);
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) {