]> granicus.if.org Git - php/commit
Hardening the reads of mysqlnd.
authorAndrey Hristov <andrey@php.net>
Tue, 20 Apr 2010 20:02:32 +0000 (20:02 +0000)
committerAndrey Hristov <andrey@php.net>
Tue, 20 Apr 2010 20:02:32 +0000 (20:02 +0000)
commit6dec27d58b4df79447b92a0cbff1a021945bfbac
tree441a56c2db0c447e7ed60ac3848e2b50e1fdf5a6
parent10a9f48eeeb20fae3eef5d5b1b35d1bcf0bd1942
Hardening the reads of mysqlnd.
All packets but the row data packet are read into preallocated buffer,
either on the stack or on the heap (cmd_buffer). The size of the buffer
is always checked to skip buffer overruns. Only up to the size of the
buffer is stored into the buffer but packet->header.size has the size of
all data sent. In this case network layer bails.

This patch hardenes the reads, so if packets are malformed and shorter
than they should be there will be no further reads in the buffer.
In short, detection of malformed packets.
ext/mysqlnd/mysqlnd_wireprotocol.c