From: Date: November 17 2008 3:00pm Subject: bzr commit into mysql-5.1 branch (kristofer.pettersson:2688) Bug#40778 List-Archive: http://lists.mysql.com/commits/58956 X-Bug: 40778 Message-Id: <0KAH00AK2DKDH1B0@fe-emea-10.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT #At file:///home/thek/Development/cpp/mysqlbzr/mysql-5.1-bug38883/ 2688 Kristofer Pettersson 2008-11-17 Bug#40778 thd_security_context has bad architecture; allocates on unprotected memroot The function thd_security_context allocates memory on an unprotected MEM_ROOT if the message length becomes longer than requested and the initial buffer memory needs to be reallocated. This patch fixes the design error by copying parts of the reallocated buffer to the destination buffer. This works because the destination buffer isn't owned by the String object and thus isn't freed when a new buffer is allocated. Any new memory allocated by the String object is reclaimed when the object is destroyed at the end of the function call.