Commit 56a583d2 authored by Sandro Volery's avatar Sandro Volery Committed by Greg Kroah-Hartman

Staging: exfat: Avoid use of strcpy

Use strscpy instead of strcpy in exfat_core.c, and add a check
for length that will return already known FFS_INVALIDPATH.
Suggested-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarSandro Volery <sandro@volery.com>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20190912082559.GA5043@volerySigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4e35a0d8
...@@ -2961,11 +2961,9 @@ s32 resolve_path(struct inode *inode, char *path, struct chain_t *p_dir, ...@@ -2961,11 +2961,9 @@ s32 resolve_path(struct inode *inode, char *path, struct chain_t *p_dir,
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
struct file_id_t *fid = &(EXFAT_I(inode)->fid); struct file_id_t *fid = &(EXFAT_I(inode)->fid);
if (strlen(path) >= (MAX_NAME_LENGTH * MAX_CHARSET_SIZE)) if (strscpy(name_buf, path, sizeof(name_buf)) < 0)
return FFS_INVALIDPATH; return FFS_INVALIDPATH;
strcpy(name_buf, path);
nls_cstring_to_uniname(sb, p_uniname, name_buf, &lossy); nls_cstring_to_uniname(sb, p_uniname, name_buf, &lossy);
if (lossy) if (lossy)
return FFS_INVALIDPATH; return FFS_INVALIDPATH;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment