]> git.ipfire.org Git - thirdparty/linux.git/commit
apparmor: Replace deprecated strcpy with memcpy in gen_symlink_name
authorThorsten Blum <thorsten.blum@linux.dev>
Thu, 16 Oct 2025 15:41:10 +0000 (17:41 +0200)
committerJohn Johansen <john.johansen@canonical.com>
Thu, 22 Jan 2026 12:52:25 +0000 (04:52 -0800)
commit1c90ed1f14c9892c24d5252a2966470f4937f7a2
tree417ebf4b7a1afa212f0ed8b6627daf50f2c86f4d
parent00b67657535dfea56e84d11492f5c0f61d0af297
apparmor: Replace deprecated strcpy with memcpy in gen_symlink_name

strcpy() is deprecated; use memcpy() instead. Unlike strcpy(), memcpy()
does not copy the NUL terminator from the source string, which would be
overwritten anyway on every iteration when using strcpy(). snprintf()
then ensures that 'char *s' is NUL-terminated.

Replace the hard-coded path length to remove the magic number 6, and add
a comment explaining the extra 11 bytes.

Closes: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/apparmorfs.c