svn commit: r229692 - head/sys/fs/pseudofs

Jaakko Heinonen jh at FreeBSD.org
Fri Jan 6 09:17:34 UTC 2012


Author: jh
Date: Fri Jan  6 09:17:34 2012
New Revision: 229692
URL: http://svn.freebsd.org/changeset/base/229692

Log:
  Check the return value of sbuf_finish() in pfs_readlink() and return
  ENAMETOOLONG if the buffer overflowed.
  
  Approved by:	des
  MFC after:	2 weeks

Modified:
  head/sys/fs/pseudofs/pseudofs_vnops.c

Modified: head/sys/fs/pseudofs/pseudofs_vnops.c
==============================================================================
--- head/sys/fs/pseudofs/pseudofs_vnops.c	Fri Jan  6 08:51:20 2012	(r229691)
+++ head/sys/fs/pseudofs/pseudofs_vnops.c	Fri Jan  6 09:17:34 2012	(r229692)
@@ -891,7 +891,11 @@ pfs_readlink(struct vop_readlink_args *v
 		PFS_RETURN (error);
 	}
 
-	sbuf_finish(&sb);
+	if (sbuf_finish(&sb) != 0) {
+		sbuf_delete(&sb);
+		PFS_RETURN (ENAMETOOLONG);
+	}
+
 	error = uiomove_frombuf(sbuf_data(&sb), sbuf_len(&sb), uio);
 	sbuf_delete(&sb);
 	PFS_RETURN (error);


More information about the svn-src-all mailing list