mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
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>
This commit is contained in:
parent
06452eb053
commit
ad917e7f82
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user