summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorZhao Hongjiang <zhaohongjiang@huawei.com>2013-06-20 14:59:51 +0400
committerDavid Teigland <teigland@redhat.com>2013-06-25 21:53:06 +0400
commitad917e7f821855a2f223131bb6c90ca6c9240bf3 (patch)
treeab187928712bbf3a394658a3d6b393cb0553bc27 /fs
parent06452eb0538827d2158945d20e3d33e359884437 (diff)
downloadlinux-ad917e7f821855a2f223131bb6c90ca6c9240bf3.tar.xz
dlm: config: using strlcpy instead of strncpy
for NUL terminated string, need alway set '\0' in the end. Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com> Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/dlm/config.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index 7d58d5b112b5..76feb4b60fa6 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -138,8 +138,9 @@ static ssize_t cluster_cluster_name_read(struct dlm_cluster *cl, char *buf)
static ssize_t cluster_cluster_name_write(struct dlm_cluster *cl,
const char *buf, size_t len)
{
- strncpy(dlm_config.ci_cluster_name, buf, DLM_LOCKSPACE_LEN);
- strncpy(cl->cl_cluster_name, buf, DLM_LOCKSPACE_LEN);
+ strlcpy(dlm_config.ci_cluster_name, buf,
+ sizeof(dlm_config.ci_cluster_name));
+ strlcpy(cl->cl_cluster_name, buf, sizeof(cl->cl_cluster_name));
return len;
}