Skip to content

Commit

Permalink
dlm: config: using strlcpy instead of strncpy
Browse files Browse the repository at this point in the history
for NUL terminated string, need alway set '\0' in the end.

Signed-off-by: Zhao Hongjiang <[email protected]>
Signed-off-by: David Teigland <[email protected]>
  • Loading branch information
Zhao Hongjiang authored and teigland committed Jun 25, 2013
1 parent 06452eb commit ad917e7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/dlm/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit ad917e7

Please sign in to comment.