An error occurred while fetching folder content.
lib/string: Add strscpy_pad() function
Tobin C. Harding authored
[ Upstream commit 458a3bf8

 ]

We have a function to copy strings safely and we have a function to copy
strings and zero the tail of the destination (if source string is
shorter than destination buffer) but we do not have a function to do
both at once.  This means developers must write this themselves if they
desire this functionality.  This is a chore, and also leaves us open to
off by one errors unnecessarily.

Add a function that calls strscpy() then memset()s the tail to zero if
the source string is shorter than the destination buffer.
Acked-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarTobin C. Harding <tobin@kernel.org>
Signed-off-by: default avatarShuah Khan <shuah@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
651b7091
Name Last commit Last update
..
842 crypto: 842 - Add CRC and validation support
fonts Fonts: Replace discarded const qualifier
lz4 lib: lz4: fixed zram with lz4 on big endian machines
lzo lzo: check for length overrun in variable length encoding.
mpi lib/mpi: Fix 64-bit MIPS build with Clang
raid6 lib: raid6: fix awk build warnings
reed_solomon rslib: Fix handling of of caller provided syndrome
xz lib/xz: enable all filters by default in Kconfig
zlib_deflate zlib_deflate/deftree: remove bi_reverse()
zlib_inflate lib/zlib: remove outdated and incorrect pre-increment optimization
.gitignore X.509: Implement simple static OID registry
Kconfig lib: sw842: select crc32
Kconfig.debug kmemleak: increase DEBUG_KMEMLEAK_EARLY_LOG_SIZE default to 16K
Kconfig.kasan mm, slub, kasan: enable user tracking by default with KASAN=y
Kconfig.kgdb kdb: Allow access to sensitive commands to be restricted by default
Kconfig.kmemcheck kmemcheck: depend on HAVE_ARCH_KMEMCHECK
Makefile siphash: add cryptographically secure PRF
argv_split.c argv_split(): teach it to handle mutable strings
asn1_decoder.c ASN.1: check for error from ASN1_OP_END__ACT actions
assoc_array.c assoc_array: Fix shortcut creation
atomic64.c atomic: Provide atomic_{or,xor,and}
atomic64_test.c x86/cpufeature: Carve out X86_FEATURE_*
audit.c syscalls: implement execveat() system call
bcd.c usb/core: use bin2bcd() for bcdDevice in RH
bch.c lib: add shared BCH ECC library
bitmap.c
bitrev.c
bsearch.c
btree.c
bug.c
build_OID_registry
bust_spinlocks.c
check_signature.c
checksum.c
clz_ctz.c
clz_tab.c
cmdline.c
compat_audit.c
cordic.c
cpu-notifier-error-inject.c
cpu_rmap.c
cpumask.c
crc-ccitt.c
crc-itu-t.c
crc-t10dif.c
crc16.c
crc32.c
crc32defs.h
crc7.c
crc8.c
ctype.c
debug_info.c
debug_locks.c
debugobjects.c
dec_and_lock.c
decompress.c
decompress_bunzip2.c
decompress_inflate.c
decompress_unlz4.c
decompress_unlzma.c
decompress_unlzo.c
decompress_unxz.c
devres.c
digsig.c
div64.c
dma-debug.c
dump_stack.c
dynamic_debug.c
dynamic_queue_limits.c
earlycpio.c
extable.c
fault-inject.c
fdt.c
fdt_empty_tree.c
fdt_ro.c
fdt_rw.c
fdt_strerror.c
fdt_sw.c
fdt_wip.c
find_bit.c
flex_array.c
flex_proportions.c
gcd.c
gen_crc32table.c
genalloc.c
glob.c
halfmd4.c
hexdump.c
hweight.c
idr.c
inflate.c
int_sqrt.c
interval_tree.c
interval_tree_test.c
iomap.c
iomap_copy.c
iommu-common.c
iommu-helper.c
ioremap.c
iov_iter.c