Re: [PATCH 8/8] nfsd: Fix misuse of strlcpy

From: J. Bruce Fields
Date: Mon Jul 08 2019 - 23:14:06 EST


On Thu, Jul 04, 2019 at 04:57:48PM -0700, Joe Perches wrote:
> Probable cut&paste typo - use the correct field size.

Huh, that's been there forever, I wonder why we haven't seen crashes?
Oh, I see, name and authname both have the same size.

Anyway, makes sense, thanks. Will apply for 5.3.

(Unless someone else is getting this; I didn't get copied on the rest of
the series.)

--b.

>
> Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
> ---
> fs/nfsd/nfs4idmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
> index 2961016097ac..d1f285245af8 100644
> --- a/fs/nfsd/nfs4idmap.c
> +++ b/fs/nfsd/nfs4idmap.c
> @@ -83,7 +83,7 @@ ent_init(struct cache_head *cnew, struct cache_head *citm)
> new->type = itm->type;
>
> strlcpy(new->name, itm->name, sizeof(new->name));
> - strlcpy(new->authname, itm->authname, sizeof(new->name));
> + strlcpy(new->authname, itm->authname, sizeof(new->authname));
> }
>
> static void
> --
> 2.15.0