svn commit: r192129 - head/lib/libc/gen

Xin LI delphij at FreeBSD.org
Thu May 14 23:09:37 UTC 2009


Author: delphij
Date: Thu May 14 23:09:33 2009
New Revision: 192129
URL: http://svn.freebsd.org/changeset/base/192129

Log:
  As the comment says, close() frees the variable, record.  So we obtain
  the length by evaluating the value from the copy, cbuf instead.  This
  fixes a crash caused by previous commit (use-after-free)
  
  Submitted by:	Dimitry Andric <dimitry andric com>
  Pointy hat to:	delphij

Modified:
  head/lib/libc/gen/getcap.c

Modified: head/lib/libc/gen/getcap.c
==============================================================================
--- head/lib/libc/gen/getcap.c	Thu May 14 22:36:56 2009	(r192128)
+++ head/lib/libc/gen/getcap.c	Thu May 14 23:09:33 2009	(r192129)
@@ -260,7 +260,7 @@ getent(char **cap, u_int *len, char **db
 					errno = ENOMEM;
 					return (-2);
 				}
-				*len = strlen(record);
+				*len = strlen(cbuf);
 				*cap = cbuf;
 				return (retval);
 			} else {


More information about the svn-src-head mailing list