Skip to content

Commit b7fa795

Browse files
authored
Merge pull request #81 from sysown/v2.x_handle_malformed_packet
Fixed handling of malformed packet
2 parents d4bd936 + e3c13fb commit b7fa795

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/MySQL_Session.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -3953,6 +3953,14 @@ int MySQL_Session::get_pkts_from_client(bool& wrong_pass, PtrSize_t& pkt) {
39533953
if (mirror==false) {
39543954
client_myds->PSarrayIN->remove_index(0,&pkt);
39553955
}
3956+
3957+
if (pkt.size <= sizeof(mysql_hdr)) {
3958+
proxy_debug(PROXY_DEBUG_MYSQL_COM, 5, "Malformed packet received\n");
3959+
l_free(pkt.size, pkt.ptr);
3960+
handler_ret = -1;
3961+
return handler_ret;
3962+
}
3963+
39563964
switch (status) {
39573965
case WAITING_CLIENT_DATA:
39583966
if (pkt.size==(0xFFFFFF+sizeof(mysql_hdr))) { // we are handling a multi-packet

0 commit comments

Comments
 (0)