mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
NFSD: Fix destination buffer size in nfsd4_ssc_setup_dul()
commitab1c282c01upstream. Commit5304877936("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 commit72f78ae00a("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:5304877936("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d9c7886b84
commit
017addab06
@@ -1372,7 +1372,7 @@ try_again:
|
||||
return 0;
|
||||
}
|
||||
if (work) {
|
||||
strscpy(work->nsui_ipaddr, ipaddr, sizeof(work->nsui_ipaddr) - 1);
|
||||
strscpy(work->nsui_ipaddr, ipaddr, sizeof(work->nsui_ipaddr));
|
||||
refcount_set(&work->nsui_refcnt, 2);
|
||||
work->nsui_busy = true;
|
||||
list_add_tail(&work->nsui_list, &nn->nfsd_ssc_mount_list);
|
||||
|
||||
Reference in New Issue
Block a user