[Ocfs2-devel] [PATCH 1/5] Add clustername to cluster connection
Andrew Morton
akpm at linux-foundation.org
Thu Oct 3 13:24:32 PDT 2013
On Thu, 3 Oct 2013 00:49:12 -0500 Goldwyn Rodrigues <rgoldwyn at suse.de> wrote:
> diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
> index 3a44a64..7c57de3 100644
> --- a/fs/ocfs2/dlmglue.c
> +++ b/fs/ocfs2/dlmglue.c
>
> ...
>
> @@ -344,6 +346,8 @@ int ocfs2_cluster_connect(const char *stack_name,
>
> memcpy(new_conn->cc_name, group, grouplen);
> new_conn->cc_namelen = grouplen;
> + memcpy(new_conn->cc_cluster_name, cluster_name, cluster_name_len);
> + new_conn->cc_cluster_name_len = cluster_name_len;
I don't know what prevents buffer overflows or lack of null-termination
here. Can we use something safer like strlcpy()?
> new_conn->cc_recovery_handler = recovery_handler;
> new_conn->cc_recovery_data = recovery_data;
>
> ...
>
> --- a/fs/ocfs2/super.c
> +++ b/fs/ocfs2/super.c
> @@ -2237,6 +2237,9 @@ static int ocfs2_initialize_super(struct super_block *sb,
> status = -EINVAL;
> goto bail;
> }
> + memcpy(osb->osb_cluster_name,
> + OCFS2_RAW_SB(di)->s_cluster_info.ci_cluster,
> + OCFS2_CLUSTER_NAME_LEN);
Ditto.
>
> ...
>
More information about the Ocfs2-devel
mailing list