summaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfsproc.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2014-06-20 11:49:49 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-07-08 17:14:23 -0400
commit0aeae33f5d5fbd4af775e7c84795db9254d4a165 (patch)
treed1d043a76f3cdf14d8a49af70f5c05806bff79a3 /fs/nfsd/nfsproc.c
parentb829e9197ad3d8b86dbd5dc1d9bbc5508d214cec (diff)
downloadlinux-0aeae33f5d5fbd4af775e7c84795db9254d4a165.tar.bz2
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: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfsproc.c')
-rw-r--r--fs/nfsd/nfsproc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 54c6b3d3cc79..aebe23c45cbe 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -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);