From: Rob Landley <rlandley@xxxxxxxxxxxxx> Make sure user string is null terminated before copying it. Signed-off-by: Rob Landley <rlandley@xxxxxxxxxxxxx> --- fs/nfs/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/nfs/super.c b/fs/nfs/super.c index b68c860..0ad1255 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -1881,9 +1881,12 @@ static int nfs_validate_mount_data(void *options, if (!(data->flags & NFS_MOUNT_TCP)) args->nfs_server.protocol = XPRT_TRANSPORT_UDP; + /* Force null termination of data->hostname no matter what + user passed in. */ + args->namlen = data->namlen; + data->namlen = 0; /* N.B. caller will free nfs_server.hostname in all cases */ args->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL); - args->namlen = data->namlen; args->bsize = data->bsize; if (data->flags & NFS_MOUNT_SECFLAVOUR) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html