linux/fs/orangefs
Amir Mohammad Jahangirzad 62b4f6c6ab fs/orangefs: use snprintf() instead of sprintf()
[ Upstream commit cdfa130465 ]

sprintf() is discouraged for use with bounded destination buffers
as it does not prevent buffer overflows when the formatted output
exceeds the destination buffer size. snprintf() is a safer
alternative as it limits the number of bytes written and ensures
NUL-termination.

Replace sprintf() with snprintf() for copying the debug string
into a temporary buffer, using ORANGEFS_MAX_DEBUG_STRING_LEN as
the maximum size to ensure safe formatting and prevent memory
corruption in edge cases.

EDIT: After this patch sat on linux-next for a few days, Dan
Carpenter saw it and suggested that I use scnprintf instead of
snprintf. I made the change and retested.

Signed-off-by: Amir Mohammad Jahangirzad <a.jahangirzad@gmail.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-08-20 18:30:41 +02:00
..
acl.c fs: port acl to mnt_idmap 2023-01-19 09:24:28 +01:00
dcache.c orangefs: cleanup uses of strncpy 2024-04-09 10:52:13 +02:00
devorangefs-req.c Merge branch 'work.compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-06-16 16:21:50 +09:00
dir.c orangefs: saner arguments passing in readdir guts 2023-12-21 12:53:36 -05:00
downcall.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
file.c orangefs: Provide a splice-read wrapper 2023-05-24 08:42:16 -06:00
inode.c orangefs: Do not truncate file size 2025-05-29 11:02:28 +02:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
namei.c orangefs: cleanup uses of strncpy 2024-04-09 10:52:13 +02:00
orangefs-bufmap.c orangefs: Remove calls to set/clear the error flag 2024-05-31 12:31:41 +02:00
orangefs-bufmap.h orangefs: copy Orangefs-sized blocks into the pagecache if possible. 2019-05-03 14:32:39 -04:00
orangefs-cache.c fs/orangefs: remove ORANGEFS_CACHE_CREATE_FLAGS 2024-02-14 15:54:50 -05:00
orangefs-debug.h orangefs: remove unused code 2018-04-03 21:55:28 -04:00
orangefs-debugfs.c fs/orangefs: use snprintf() instead of sprintf() 2025-08-20 18:30:41 +02:00
orangefs-debugfs.h orangefs: fix build warning from debugfs cleanup patch 2019-07-04 10:30:33 +02:00
orangefs-dev-proto.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
orangefs-kernel.h move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
orangefs-mod.c orangefs: Fix sysfs not cleanup when dev init failed 2022-12-07 15:18:29 -05:00
orangefs-sysfs.c orangefs: Constify struct kobj_type 2024-09-06 10:18:17 -04:00
orangefs-sysfs.h Orangefs: change pvfs2 filenames to orangefs 2015-12-04 12:56:14 -05:00
orangefs-utils.c orangefs: convert to new timestamp accessors 2023-10-18 14:08:25 +02:00
protocol.h orangefs: specify user pointers when using dev_map_desc and bufmap 2018-06-01 14:51:36 -04:00
super.c orangefs: fix out-of-bounds fsid access 2024-05-14 17:44:14 -07:00
symlink.c orangefs: stop setting atime on inode dirty 2017-11-13 15:10:11 -05:00
upcall.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
waitqueue.c orangefs: service ops done for writeback are not killable 2019-05-03 14:32:38 -04:00
xattr.c orangefs: move orangefs_xattr_handlers to .rodata 2023-10-09 16:24:21 +02:00