Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bb320c5 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Sasha Levin
Browse files

NFS: Fix an off by one in root_nfs_cat()



[ Upstream commit 698ad1a538da0b6bf969cfee630b4e3a026afb87 ]

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: 56463e50 ("NFS: Use super.c for NFSROOT mount option parsing")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarBenjamin Coddington <bcodding@redhat.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 867a6a68
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -169,10 +169,10 @@ static int __init root_nfs_cat(char *dest, const char *src,
	size_t len = strlen(dest);

	if (len && dest[len - 1] != ',')
		if (strlcat(dest, ",", destlen) > destlen)
		if (strlcat(dest, ",", destlen) >= destlen)
			return -1;

	if (strlcat(dest, src, destlen) > destlen)
	if (strlcat(dest, src, destlen) >= destlen)
		return -1;
	return 0;
}