[PATCH] pwdgrp::read_group(): Don't call free() twice with the same address

David Rothenberger daveroth@acm.org
Fri Aug 8 19:25:00 GMT 2003


Hi,

This patch avoids the heap corruption that was causing the problem
described in
<http://www.cygwin.com/ml/cygwin/2003-08/msg00364.html>.

In pwdgrp::read_group(), there is loop to free allocated gr_mem
buffers.  That loop checks to see if gr_mem != &null_ptr, but does
not set gr_mem to &null_ptr after free() is called.  Subsequent
calls then attempt to free the same address again, corrupting the
malloc structures.

The tar test case triggers this behavior if there is no /etc
directory available, for some reason.

Dave

======================================================================
ChangeLog:
2003-08-08  David Rothenberger  <daveroth@acm.org>

	* grp.cc (read_group): Set __group32.gr_mem pointer back to
	&null_ptr after free() is called.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: grp.patch
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20030808/b0adb8c7/attachment.ksh>


More information about the Cygwin-patches mailing list