summaryrefslogtreecommitdiff
path: root/fs/befs/btree.c
diff options
context:
space:
mode:
authorAzeem Shaikh <azeemshaikh38@gmail.com>2023-05-09 01:41:36 +0000
committerKees Cook <keescook@chromium.org>2023-05-30 16:42:00 -0700
commit7391928025f28cd4cab43e59d2b4e36509b9337e (patch)
tree8cb9d32863953511505ce6624961ceed7ad31a94 /fs/befs/btree.c
parent2f088dfc1878108748018af0d2e3748ba9eee1e9 (diff)
befs: Replace all non-returning strlcpy with strscpy
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated. In an effort to remove strlcpy() completely, replace strlcpy() here with strscpy(). No return values were used, so direct replacement is safe. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [2] https://github.com/KSPP/linux/issues/89 Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20230509014136.2095900-1-azeemshaikh38@gmail.com
Diffstat (limited to 'fs/befs/btree.c')
-rw-r--r--fs/befs/btree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/befs/btree.c b/fs/befs/btree.c
index 1b7e0f7128d6..53b36aa29978 100644
--- a/fs/befs/btree.c
+++ b/fs/befs/btree.c
@@ -500,7 +500,7 @@ befs_btree_read(struct super_block *sb, const befs_data_stream *ds,
goto error_alloc;
}
- strlcpy(keybuf, keystart, keylen + 1);
+ strscpy(keybuf, keystart, keylen + 1);
*value = fs64_to_cpu(sb, valarray[cur_key]);
*keysize = keylen;