Skip to content

Commit

Permalink
Merge pull request #81 from sysown/v2.x_handle_malformed_packet
Browse files Browse the repository at this point in the history
Fixed handling of malformed packet
  • Loading branch information
renecannao authored Sep 20, 2024
2 parents d4bd936 + e3c13fb commit b7fa795
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/MySQL_Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3953,6 +3953,14 @@ int MySQL_Session::get_pkts_from_client(bool& wrong_pass, PtrSize_t& pkt) {
if (mirror==false) {
client_myds->PSarrayIN->remove_index(0,&pkt);
}

if (pkt.size <= sizeof(mysql_hdr)) {
proxy_debug(PROXY_DEBUG_MYSQL_COM, 5, "Malformed packet received\n");
l_free(pkt.size, pkt.ptr);
handler_ret = -1;
return handler_ret;
}

switch (status) {
case WAITING_CLIENT_DATA:
if (pkt.size==(0xFFFFFF+sizeof(mysql_hdr))) { // we are handling a multi-packet
Expand Down

0 comments on commit b7fa795

Please sign in to comment.