Bug #37917 COM_STMT_CLOSE can be tricked to read invalid memory

Submitted: 7 Jul 2008 8:40 Modified: 17 Jul 2008 11:15
Reporter: Jan Kneschke Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.51a OS:Any
Assigned to: CPU Architecture:Any

[7 Jul 2008 8:40] Jan Kneschke
Description:
mysql_stmt_close() reads 4 bytes from the network-buffer without checking that there are enough bytes provided.

This is related to http://bugs.mysql.com/37916

How to repeat:
read sql_prepare.cc

  @note
    we don't send any reply to this command.

  void mysql_stmt_close(THD *thd, char *packet)
  {
    /* There is always space for 4 bytes in packet buffer */
    ulong stmt_id= uint4korr(packet);

Suggested fix:
* add packet_len parameter
* check if there are at least 4 bytes in the packet
[17 Jul 2008 11:15] Konstantin Osipov
Closing on the same premise as Bug#37915 -- the buffer is allocated and it's "okay" to look at uninitialized data in this case.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.