summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorTobin C. Harding <tobin@kernel.org>2019-04-05 12:58:58 +1100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-02-23 13:59:14 +0100
commit316c6cc08df0adef4f7e336ad801ac142b70dc8d (patch)
tree2a6adbdddcb29058e25784977c4c333727228fad /mm
parent3a184a1f3196543c161b8a190213786cef3dd82f (diff)
downloadlinux-stable-316c6cc08df0adef4f7e336ad801ac142b70dc8d.tar.gz
linux-stable-316c6cc08df0adef4f7e336ad801ac142b70dc8d.tar.bz2
linux-stable-316c6cc08df0adef4f7e336ad801ac142b70dc8d.zip
lib/string: Add strscpy_pad() function
[ Upstream commit 458a3bf82df4fe1f951d0f52b1e0c1e9d5a88a3b ] 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: Kees Cook <keescook@chromium.org> Signed-off-by: Tobin C. Harding <tobin@kernel.org> Signed-off-by: Shuah Khan <shuah@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'mm')
0 files changed, 0 insertions, 0 deletions