[Gluster-devel] [PATCH] fix possible array out of bound

Pranith Kumar Karampuri pkarampu at redhat.com
Tue Aug 12 14:04:13 UTC 2014


hi,
    Welcome to glusterfs :-). Could you please follow the instructions 
here to send the patch.
http://www.gluster.org/community/documentation/index.php/Simplified_dev_workflow

Pranith.

On 08/12/2014 08:52 AM, Ruoyu wrote:
> fix dangerous usage of volname because strncpy does not always
> null-terminated.
>
> Signed-off-by: Ruoyu <liangry at ucweb.com>
> ---
>   xlators/nfs/server/src/nfs-common.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c
> index f74396e..1462c1b 100644
> --- a/xlators/nfs/server/src/nfs-common.c
> +++ b/xlators/nfs/server/src/nfs-common.c
> @@ -85,7 +85,7 @@ nfs_mntpath_to_xlator (xlator_list_t *cl, char *path)
>           if ((!cl) || (!path))
>                   return NULL;
>   
> -        strncpy (volname, path, MNTPATHLEN);
> +        snprintf (volname, sizeof(volname), "%s", path);
>           pathlen = strlen (volname);
>           gf_log (GF_NFS, GF_LOG_TRACE, "Subvolume search: %s", path);
>           if (volname[0] == '/')



More information about the Gluster-devel mailing list