]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
NFSD: Fix destination buffer size in nfsd4_ssc_setup_dul()
authorThorsten Blum <thorsten.blum@linux.dev>
Wed, 6 Aug 2025 01:10:01 +0000 (03:10 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 19 Oct 2025 14:33:58 +0000 (16:33 +0200)
commit017addab06aa1ccea53e5812c59eed29aa636bd7
tree70bd81a8bd53d07fe24f06046784c64989f6b5c9
parentd9c7886b84b303a893dd7b43ee871f5b1a653b2b
NFSD: Fix destination buffer size in nfsd4_ssc_setup_dul()

commit ab1c282c010c4f327bd7addc3c0035fd8e3c1721 upstream.

Commit 5304877936c0 ("NFSD: Fix strncpy() fortify warning") replaced
strncpy(,, sizeof(..)) with strlcpy(,, sizeof(..) - 1), but strlcpy()
already guaranteed NUL-termination of the destination buffer and
subtracting one byte potentially truncated the source string.

The incorrect size was then carried over in commit 72f78ae00a8e ("NFSD:
move from strlcpy with unused retval to strscpy") when switching from
strlcpy() to strscpy().

Fix this off-by-one error by using the full size of the destination
buffer again.

Cc: stable@vger.kernel.org
Fixes: 5304877936c0 ("NFSD: Fix strncpy() fortify warning")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/nfs4proc.c