cifs: 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: Steve French <smfrench@gmail.com>
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index d5f866a..53a1780 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3732,7 +3732,7 @@
}
bcc_ptr += length + 1;
bytes_left -= (length + 1);
- strncpy(tcon->treeName, tree, MAX_TREE_SIZE);
+ strlcpy(tcon->treeName, tree, sizeof(tcon->treeName));
/* mostly informational -- no need to fail on error here */
kfree(tcon->nativeFileSystem);