mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 05:12:49 +00:00
NFS: Fix an off by one in root_nfs_cat()
[ Upstream commit698ad1a538
] The intent is to check if 'dest' is truncated or not. So, >= should be used instead of >, because strlcat() returns the length of 'dest' and 'src' excluding the trailing NULL. Fixes:56463e50d1
("NFS: Use super.c for NFSROOT mount option parsing") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
867a6a6899
commit
9bb320c5ce
1 changed files with 2 additions and 2 deletions
|
@ -169,10 +169,10 @@ static int __init root_nfs_cat(char *dest, const char *src,
|
||||||
size_t len = strlen(dest);
|
size_t len = strlen(dest);
|
||||||
|
|
||||||
if (len && dest[len - 1] != ',')
|
if (len && dest[len - 1] != ',')
|
||||||
if (strlcat(dest, ",", destlen) > destlen)
|
if (strlcat(dest, ",", destlen) >= destlen)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (strlcat(dest, src, destlen) > destlen)
|
if (strlcat(dest, src, destlen) >= destlen)
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue