Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/nfs nfsrv_readlink: stop attaching a zero-l...



details:   https://anonhg.NetBSD.org/src/rev/3205fb969f92
branches:  trunk
changeset: 318685:3205fb969f92
user:      hannken <hannken%NetBSD.org@localhost>
date:      Thu May 03 07:28:43 2018 +0000
description:
nfsrv_readlink: stop attaching a zero-length mbuf for zero length symlinks.

diffstat:

 sys/nfs/nfs_serv.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 704c9e120764 -r 3205fb969f92 sys/nfs/nfs_serv.c
--- a/sys/nfs/nfs_serv.c        Thu May 03 07:25:49 2018 +0000
+++ b/sys/nfs/nfs_serv.c        Thu May 03 07:28:43 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_serv.c,v 1.173 2017/04/26 03:02:49 riastradh Exp $ */
+/*     $NetBSD: nfs_serv.c,v 1.174 2018/05/03 07:28:43 hannken Exp $   */
 
 /*
  * Copyright (c) 1989, 1993
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.173 2017/04/26 03:02:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.174 2018/05/03 07:28:43 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -600,7 +600,10 @@
        }
        len -= uiop->uio_resid;
        padlen = nfsm_padlen(len);
-       if (uiop->uio_resid || padlen)
+       if (len == 0) {
+               m_freem(mp3);
+               mp3 = NULL;
+       } else if (uiop->uio_resid || padlen)
                nfs_zeropad(mp3, uiop->uio_resid, padlen);
        nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
        *tl = txdr_unsigned(len);



Home | Main Index | Thread Index | Old Index