From bfeaecd0aa5f3c571b370b45d6cec61c174dd6d0 Mon Sep 17 00:00:00 2001 From: Vlad Grigorescu Date: Thu, 23 Jul 2020 11:51:18 -0500 Subject: [PATCH] MySQL: Fix parsing logic bug. We were correctly NOT expecting an EOF, but because we were parsing the header and then not parsing the rest, we would get out of sync --- src/analyzer/protocol/mysql/mysql-protocol.pac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/analyzer/protocol/mysql/mysql-protocol.pac b/src/analyzer/protocol/mysql/mysql-protocol.pac index 6b4128f967..a54246ef9c 100644 --- a/src/analyzer/protocol/mysql/mysql-protocol.pac +++ b/src/analyzer/protocol/mysql/mysql-protocol.pac @@ -273,7 +273,7 @@ type Command_Response(pkt_len: uint32) = case $context.connection.get_expectatio EXPECT_REST_OF_PACKET -> rest : bytestring &restofdata; EXPECT_STATUS -> status : Command_Response_Status; EXPECT_AUTH_SWITCH -> auth_switch : AuthSwitchRequest; - EXPECT_EOF -> eof : EOFIfLegacy; + EXPECT_EOF -> eof : EOFIfLegacy(pkt_len); default -> unknown : empty; }; @@ -333,9 +333,9 @@ type ColumnDefinitionOrEOF(pkt_len: uint32) = record { }; -type EOFIfLegacy = case $context.connection.get_deprecate_eof() of { +type EOFIfLegacy(pkt_len: uint32) = case $context.connection.get_deprecate_eof() of { false -> eof: EOF_Packet; - true -> none: empty; + true -> resultset: Resultset(pkt_len); } &let { update_result_seen: bool = $context.connection.set_results_seen(0); update_expectation: bool = $context.connection.set_next_expected(EXPECT_RESULTSET);