diff options
author | Sandro Volery <sandro@volery.com> | 2019-09-12 11:25:59 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-12 12:25:05 +0300 |
commit | 56a583d264b97e34d3c6009f50f113450e63a1de (patch) | |
tree | f0048d2c0a0d5a9cf560059a67a132435279673b /drivers/staging | |
parent | 4e35a0d87cbd16553293f7d48a4ffddbd36cec77 (diff) | |
download | linux-56a583d264b97e34d3c6009f50f113450e63a1de.tar.xz |
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: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Sandro Volery <sandro@volery.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20190912082559.GA5043@volery
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/exfat/exfat_core.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c index 6eee2aa06bd7..b3e9cf725cf5 100644 --- a/drivers/staging/exfat/exfat_core.c +++ b/drivers/staging/exfat/exfat_core.c @@ -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 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; - strcpy(name_buf, path); - nls_cstring_to_uniname(sb, p_uniname, name_buf, &lossy); if (lossy) return FFS_INVALIDPATH; |