This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

Attachment: grp.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]