linux-yocto/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>
2025-08-20 18:30:41 +02:00
..
acl.c
dcache.c orangefs: cleanup uses of strncpy 2024-04-09 10:52:13 +02:00
devorangefs-req.c
dir.c
downcall.h
file.c
inode.c orangefs: Do not truncate file size 2025-05-29 11:02:28 +02:00
Kconfig
Makefile
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-cache.c
orangefs-debug.h
orangefs-debugfs.c fs/orangefs: use snprintf() instead of sprintf() 2025-08-20 18:30:41 +02:00
orangefs-debugfs.h
orangefs-dev-proto.h
orangefs-kernel.h move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
orangefs-mod.c
orangefs-sysfs.c orangefs: Constify struct kobj_type 2024-09-06 10:18:17 -04:00
orangefs-sysfs.h
orangefs-utils.c
protocol.h
super.c orangefs: fix out-of-bounds fsid access 2024-05-14 17:44:14 -07:00
symlink.c
upcall.h
waitqueue.c
xattr.c