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

Commit 0aeae33f authored by J. Bruce Fields's avatar J. Bruce Fields
Browse files

nfsd: make NFSv2 null terminate symlink data



It's simple enough for NFSv2 to null-terminate the symlink data.

A bit weird (it depends on knowing that we've already read the following
byte, which is either padding or part of the mode), but no worse than
the conditional kstrdup it otherwise relies on in nfsd_symlink().

Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent b829e919
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -403,8 +403,11 @@ nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp,

	fh_init(&newfh, NFS_FHSIZE);
	/*
	 * Create the link, look up new file and set attrs.
	 * Crazy hack: the request fits in a page, and already-decoded
	 * attributes follow argp->tname, so it's safe to just write a
	 * null to ensure it's null-terminated:
	 */
	argp->tname[argp->tlen] = '\0';
	nfserr = nfsd_symlink(rqstp, &argp->ffh, argp->fname, argp->flen,
						 argp->tname, argp->tlen,
				 		 &newfh, &argp->attrs);